Skip to content

Commit 83c2fcf

Browse files
author
Eric Wong
committed
git-svn: fix delete+add branch tracking with empty files
Original bug report and test case by Björn Steinbrink. Björn Steinbrink <[email protected]> wrote: > Hi Eric, > > seems that the empty symlink stuff gets confused about which revision to > use when looking for the parent's file. > > r3 = f1a6fcf6b0a1c4a373d0b2b65a3d70700084f361 (tags/1.0.1) > Found possible branch point: file:///home/doener/h/svn/tags/1.0 => file:///home/doener/h/svn/branches/1.0, 4 > Found branch parent: (1.0) 63ae640ba01014ecbb3df590999ed1fa5914545b > Following parent with do_switch > Successfully followed parent > r5 = 26fcfef5bcced97ab74faf1af7341a2ae0d272aa (1.0) > Found possible branch point: file:///home/doener/h/svn/branches/1.0 => file:///home/doener/h/svn/tags/1.0.1, 5 > Found branch parent: (tags/1.0.1) 26fcfef5bcced97ab74faf1af7341a2ae0d272aa > Following parent with do_switch > Scanning for empty symlinks, this may take a while if you have many empty files > You may disable this with `git config svn.brokenSymlinkWorkaround false'. > This may be done in a different terminal without restarting git svn > Filesystem has no item: File not found: revision 3, path '/branches/1.0/file' at /usr/local/libexec/git-core/git-svn line 3318 > > Note how it tries to look at revision 3 instead of revision 5 (which it > correctly detected as the parent). The import succeeds when > svn.brokenSymlinkWorkaround is set to false. Testcase below. Signed-off-by: Eric Wong <[email protected]>
1 parent 7d9fd45 commit 83c2fcf

File tree

3 files changed

+205
-0
lines changed

3 files changed

+205
-0
lines changed

git-svn.perl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,6 +2421,7 @@ sub find_parent_branch {
24212421
# do_switch works with svn/trunk >= r22312, but that
24222422
# is not included with SVN 1.4.3 (the latest version
24232423
# at the moment), so we can't rely on it
2424+
$self->{last_rev} = $r0;
24242425
$self->{last_commit} = $parent;
24252426
$ed = SVN::Git::Fetcher->new($self, $gs->{path});
24262427
$gs->ra->gs_do_switch($r0, $rev, $gs,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
3+
test_description='test recreated svn branch with empty files'
4+
5+
. ./lib-git-svn.sh
6+
test_expect_success 'load svn dumpfile' '
7+
svnadmin load "$rawsvnrepo" < "${TEST_DIRECTORY}/t9136/svn.dump"
8+
'
9+
10+
test_expect_success 'clone using git svn' 'git svn clone -s "$svnrepo" x'
11+
12+
test_done

t/t9136/svn.dump

Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
SVN-fs-dump-format-version: 2
2+
3+
UUID: eecae021-8f16-48da-969d-79beb8ae6ea5
4+
5+
Revision-number: 0
6+
Prop-content-length: 56
7+
Content-length: 56
8+
9+
K 8
10+
svn:date
11+
V 27
12+
2009-02-22T00:50:56.292890Z
13+
PROPS-END
14+
15+
Revision-number: 1
16+
Prop-content-length: 106
17+
Content-length: 106
18+
19+
K 7
20+
svn:log
21+
V 4
22+
init
23+
K 10
24+
svn:author
25+
V 8
26+
john.doe
27+
K 8
28+
svn:date
29+
V 27
30+
2009-02-22T00:50:57.192384Z
31+
PROPS-END
32+
33+
Node-path: branches
34+
Node-kind: dir
35+
Node-action: add
36+
Prop-content-length: 10
37+
Content-length: 10
38+
39+
PROPS-END
40+
41+
42+
Node-path: tags
43+
Node-kind: dir
44+
Node-action: add
45+
Prop-content-length: 10
46+
Content-length: 10
47+
48+
PROPS-END
49+
50+
51+
Node-path: trunk
52+
Node-kind: dir
53+
Node-action: add
54+
Prop-content-length: 10
55+
Content-length: 10
56+
57+
PROPS-END
58+
59+
60+
Node-path: trunk/file
61+
Node-kind: file
62+
Node-action: add
63+
Prop-content-length: 10
64+
Text-content-length: 0
65+
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
66+
Content-length: 10
67+
68+
PROPS-END
69+
70+
71+
Revision-number: 2
72+
Prop-content-length: 105
73+
Content-length: 105
74+
75+
K 7
76+
svn:log
77+
V 3
78+
1.0
79+
K 10
80+
svn:author
81+
V 8
82+
john.doe
83+
K 8
84+
svn:date
85+
V 27
86+
2009-02-22T00:50:58.124724Z
87+
PROPS-END
88+
89+
Node-path: tags/1.0
90+
Node-kind: dir
91+
Node-action: add
92+
Node-copyfrom-rev: 1
93+
Node-copyfrom-path: trunk
94+
95+
96+
Revision-number: 3
97+
Prop-content-length: 111
98+
Content-length: 111
99+
100+
K 7
101+
svn:log
102+
V 9
103+
1.0.1-bad
104+
K 10
105+
svn:author
106+
V 8
107+
john.doe
108+
K 8
109+
svn:date
110+
V 27
111+
2009-02-22T00:50:58.151727Z
112+
PROPS-END
113+
114+
Node-path: tags/1.0.1
115+
Node-kind: dir
116+
Node-action: add
117+
Node-copyfrom-rev: 2
118+
Node-copyfrom-path: tags/1.0
119+
120+
121+
Revision-number: 4
122+
Prop-content-length: 111
123+
Content-length: 111
124+
125+
K 7
126+
svn:log
127+
V 9
128+
Wrong tag
129+
K 10
130+
svn:author
131+
V 8
132+
john.doe
133+
K 8
134+
svn:date
135+
V 27
136+
2009-02-22T00:50:58.167427Z
137+
PROPS-END
138+
139+
Node-path: tags/1.0.1
140+
Node-action: delete
141+
142+
143+
Revision-number: 5
144+
Prop-content-length: 113
145+
Content-length: 113
146+
147+
K 7
148+
svn:log
149+
V 10
150+
1.0-branch
151+
K 10
152+
svn:author
153+
V 8
154+
john.doe
155+
K 8
156+
svn:date
157+
V 27
158+
2009-02-22T00:50:58.184498Z
159+
PROPS-END
160+
161+
Node-path: branches/1.0
162+
Node-kind: dir
163+
Node-action: add
164+
Node-copyfrom-rev: 4
165+
Node-copyfrom-path: tags/1.0
166+
167+
168+
Revision-number: 6
169+
Prop-content-length: 113
170+
Content-length: 113
171+
172+
K 7
173+
svn:log
174+
V 10
175+
1.0.1-good
176+
K 10
177+
svn:author
178+
V 8
179+
john.doe
180+
K 8
181+
svn:date
182+
V 27
183+
2009-02-22T00:50:58.200695Z
184+
PROPS-END
185+
186+
Node-path: tags/1.0.1
187+
Node-kind: dir
188+
Node-action: add
189+
Node-copyfrom-rev: 5
190+
Node-copyfrom-path: branches/1.0
191+
192+

0 commit comments

Comments
 (0)