git-svn vs. $Id$
Hi. I just ran into trouble with git-svn, related to a file containing $Id$. Yes, I know $Id$ sucks and should be avoided, and I'll be removing them shortly, but that doesn't change the fact that the history contains files with them.
Just wanted to let you know of a workaround:
manually edit the relevant file in .git/git-svn/tree/ to undo the $Id$ change, and git-svn fetch works again.
$ git-svn fetch
Tree mismatch, Got: c242bb60d78c1dfce133e0bbaca7f13895de00b2, Expected:
07d35ac911cc56aabea86f4467cafc1d92b724c4
at /home/tv/bin/git-svn line 426
main::assert_tree('a5890d459de08dc8adbbe34cdfb4b1f44f377ad8')
called at /home/tv/bin/git-svn line 392
main::assert_svn_wc_clean(2039,
'a5890d459de08dc8adbbe34cdfb4b1f44f377ad8') called at
/home/tv/bin/git-svn line 262
main::fetch() called at /home/tv/bin/git-svn line 105$ git diff-tree -p 07d35ac911cc56aabea86f4467cafc1d92b724c4 \ c242bb60d78c1dfce133e0bbaca7f13895de00b2
anonymized +1 -1
@@ -1,4 +1,4 @@ -## $Id: anonymized 1775 2006-04-20 09:25:22Z tv $ +## $Id: anonymized 2025 2006-05-16 07:25:24Z tv $ blah blah
So editing .git/git-svn/tree/anonymized and replacing "1775 2006-04-20 09:25:22Z tv" with "2025 2006-05-16 07:25:24Z tv" make git-svn happy again.
Signature · 3 lines
Inoi Oy, Tykistökatu 4 D (4. krs), FI-20520 Turku, Finland http://www.inoi.fi/ Mobile +358 40 762 5656
Quoted 4 lines · Tommi Virtanen
Just wanted to let you know of a workaround:
manually edit the relevant file in .git/git-svn/tree/ to undo the $Id$ change, and git-svn fetch works again.
Isn't there some flag to svn to avoid keyword expansion, like "-ko" to CVS?
Any import script definitely should avoid keyword expansion (and that's true whether you end up wanting to use keywords or not).
(And yes, CVS is probably a bad example. Those "substitution modes" are confusing as hell, and I don't know which one is the right one. Is it "-ko" or "-kk"? Don't ask me, I'm CVS-illiterate. I don't know why the current cvsimport uses -kk, and only does it conditionally. Whatever.)
Linus
Quoted 5 lines · Linus Torvalds
Isn't there some flag to svn to avoid keyword expansion, like "-ko" to CVS?
Any import script definitely should avoid keyword expansion (and that's true whether you end up wanting to use keywords or not).
Well, yes, I agree. But, at least git-svn.txt says this:
BUGS
----
...
svn:keywords can't be ignored in Subversion (at least I don't know of a way to ignore them).
I guess one might be able to reach that information through the svn API.
Or just propget svn:keywords and sed s/\$Id\(:[^$]*\)\$/$Id$/ all files with keywords, for all relevant keywords. Eww.
Signature · 3 lines
Inoi Oy, Tykistökatu 4 D (4. krs), FI-20520 Turku, Finland http://www.inoi.fi/ Mobile +358 40 762 5656
Quoted 15 lines · Tommi Virtanen
Quoted 5 lines · Linus Torvalds
Isn't there some flag to svn to avoid keyword expansion, like "-ko" to CVS?
Any import script definitely should avoid keyword expansion (and that's true whether you end up wanting to use keywords or not).
Well, yes, I agree. But, at least git-svn.txt says this:
BUGS
----
...
svn:keywords can't be ignored in Subversion (at least I don't know of a way to ignore them).
Quoted 4 lines
I guess one might be able to reach that information through the svn API.
Or just propget svn:keywords and sed s/\$Id\(:[^$]*\)\$/$Id$/ all files with keywords, for all relevant keywords. Eww.
I'm working on a solution to this (using files in .svn/text-base).
keyword expansion behavior seems inconsistent on some SVN repos and I can't reproduce it on my local repositories, so I think I will have to weaken some integrity checks[1] in git-svn to work around it...
1 - I don't think these integrity checks were ever tripped in the first place.
Signature · 1 line
Eric Wong
PATCH 1/1 git-svn: ignore expansion of svn:keywords
In reply to Tommi VirtanenCan you try this patch?
This weakens an integrity in order to work on certain repositories (see comments). It's probably safe to use, though... More testing and feedback would be nice.
I've split out the test for this feature to make things easier to manage and test, too.
Also changed assert_svn_wc_clean() to only work on svn, and require a separate call to assert_tree() to check wc integrity against git in preparation for another change I'm planning.
---
@Junio: please don't apply this to git.git just yet, thanks.
contrib/git-svn/Makefile | 1 contrib/git-svn/git-svn.perl | 79 +++++++++++++++++----- contrib/git-svn/t/lib-git-svn.sh | 39 +++++++++++ contrib/git-svn/t/t0000-contrib-git-svn.sh | 43 +----------- contrib/git-svn/t/t0001-contrib-git-svn-props.sh | 51 ++++++++++++++ 5 files changed, 153 insertions(+), 60 deletions(-) create mode 100644 contrib/git-svn/t/lib-git-svn.sh create mode 100644 contrib/git-svn/t/t0001-contrib-git-svn-props.sh
eb8f17257c7d15ec6815baf18208af06f72b3cdb
contrib/git-svn/Makefile +1 -0
@@ -30,6 +30,7 @@ git-svn.html : git-svn.txt -f ../../Documentation/asciidoc.conf $< test: git-svn cd t && $(SHELL) ./t0000-contrib-git-svn.sh + cd t && $(SHELL) ./t0001-contrib-git-svn-props.sh clean: rm -f git-svn *.xml *.html *.1
contrib/git-svn/git-svn.perl +60 -19
161 lines not on this page · raw message
contrib/git-svn/t/lib-git-svn.sh new file +39 -0
@@ -0,0 +1,39 @@ +PATH=$PWD/../:$PATH +if test -d ../../../t +then + cd ../../../t +else + echo "Must be run in contrib/git-svn/t" >&2 + exit 1 +fi + +. ./test-lib.sh + +GIT_DIR=$PWD/.git +GIT_SVN_DIR=$GIT_DIR/git-svn +SVN_TREE=$GIT_SVN_DIR/tree + +svnadmin >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping contrib/git-svn test' : + test_done + exit +fi + +svn >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping contrib/git-svn test' : + test_done + exit +fi + +svnrepo=$PWD/svnrepo + +set -e + +svnadmin create $svnrepo +svnrepo="file://$svnrepo/test-git-svn" + +
contrib/git-svn/t/t0000-contrib-git-svn.sh +2 -41
60 lines not on this page · raw message
contrib/git-svn/t/t0001-contrib-git-svn-props.sh new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
1.3.2.g7d11
Tommi: I'm reasonably confident about this patch, but I won't be getting much real-world usage since I rarely see repos that use svn:keywords, and I'm afflicted with RSI which prevents me from doing very much in front of a computer these days. So feedback/testing from you or any other git-svn guine^Wusers would be greatly appreciated.
Junio: This is probably safe enough for next or even master, the one in pu is completely broken wrt svn:eol-style.
PATCH 1/1 git-svn: starting a 1.1.0-pre development version
Some not-very-well-tested changes coming...
---
contrib/git-svn/git-svn.perl | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
49967a4b7bc2c9938b0ebf0670cd47d4ccfe85a3
contrib/git-svn/git-svn.perl +1 -1
@@ -8,7 +8,7 @@ use vars qw/ $AUTHOR $VERSION $GIT_SVN_INDEX $GIT_SVN $GIT_DIR $REV_DIR/; $AUTHOR = 'Eric Wong <[email protected]>'; -$VERSION = '1.0.0'; +$VERSION = '1.1.0-pre'; use Cwd qw/abs_path/; $GIT_DIR = abs_path($ENV{GIT_DIR} || '.git');
Signature · 1 line
1.3.2.g7d11
PATCH 1/1 git-svn: ignore expansion of svn:keywords
Unlike my earlier test patch, this also checks svn:eol-style and makes sure it's applied to working copy updates. This is definitely more correct than my original attempt at killing keyword expansions, but I still haven't tested it enough to know. Feedback would be much appreciated.
Also changed assert_svn_wc_clean() to only work on the svn working copy. This requires a separate call to assert_tree() to check wc integrity against git in preparation for another change I'm planning.
---
contrib/git-svn/Makefile | 1 contrib/git-svn/git-svn.perl | 106 +++++++++++++++---- contrib/git-svn/t/lib-git-svn.sh | 39 +++++++ contrib/git-svn/t/t0000-contrib-git-svn.sh | 43 -------- contrib/git-svn/t/t0001-contrib-git-svn-props.sh | 125 ++++++++++++++++++++++ 5 files changed, 254 insertions(+), 60 deletions(-) create mode 100644 contrib/git-svn/t/lib-git-svn.sh create mode 100644 contrib/git-svn/t/t0001-contrib-git-svn-props.sh
b9ba79157fc4f92e14aac89d9a5f838539d6eede
contrib/git-svn/Makefile +1 -0
@@ -30,6 +30,7 @@ git-svn.html : git-svn.txt -f ../../Documentation/asciidoc.conf $< test: git-svn cd t && $(SHELL) ./t0000-contrib-git-svn.sh + cd t && $(SHELL) ./t0001-contrib-git-svn-props.sh clean: rm -f git-svn *.xml *.html *.1
contrib/git-svn/git-svn.perl +87 -19
190 lines not on this page · raw message
contrib/git-svn/t/lib-git-svn.sh new file +39 -0
@@ -0,0 +1,39 @@ +PATH=$PWD/../:$PATH +if test -d ../../../t +then + cd ../../../t +else + echo "Must be run in contrib/git-svn/t" >&2 + exit 1 +fi + +. ./test-lib.sh + +GIT_DIR=$PWD/.git +GIT_SVN_DIR=$GIT_DIR/git-svn +SVN_TREE=$GIT_SVN_DIR/tree + +svnadmin >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping contrib/git-svn test' : + test_done + exit +fi + +svn >/dev/null 2>&1 +if test $? != 1 +then + test_expect_success 'skipping contrib/git-svn test' : + test_done + exit +fi + +svnrepo=$PWD/svnrepo + +set -e + +svnadmin create $svnrepo +svnrepo="file://$svnrepo/test-git-svn" + +
contrib/git-svn/t/t0000-contrib-git-svn.sh +2 -41
60 lines not on this page · raw message
contrib/git-svn/t/t0001-contrib-git-svn-props.sh new file +125 -0
125 lines not on this page · raw message
Signature · 1 line
1.3.2.g7d11