Skip to content

Commit f61cc48

Browse files
Eric Wonggitster
authored andcommitted
git-svn: fix following renamed paths when tracking a single path
When using git-svn to follow only a single (empty) path per svn-remote (i.e. not using --stdlayout), following the history of a renamed path was broken in c586879. This reverts the regression for the single (emtpy) path per svn-remote case. To avoid breaking the tests in a committed revision, this is an addendum to a patch originally submitted by Santhosh Kumar Mani <[email protected]>: > git-svn: add test for renamed directory fetch > > This test tries to fetch a directory which had renames in the > history from a SVN repository. [ew: unneccesary dependency on the starting an HTTP server removed from Santhosh's original test.] Signed-off-by: Eric Wong <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a1c0dca commit f61cc48

File tree

3 files changed

+113
-2
lines changed

3 files changed

+113
-2
lines changed

git-svn.perl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2239,12 +2239,13 @@ sub find_parent_branch {
22392239
# just grow a tail if we're not unique enough :x
22402240
$ref_id .= '-' while find_ref($ref_id);
22412241
print STDERR "Initializing parent: $ref_id\n";
2242-
my ($u, $p) = ($new_url, '');
2242+
my ($u, $p, $repo_id) = ($new_url, '', $ref_id);
22432243
if ($u =~ s#^\Q$url\E(/|$)##) {
22442244
$p = $u;
22452245
$u = $url;
2246+
$repo_id = $self->{repo_id};
22462247
}
2247-
$gs = Git::SVN->init($u, $p, $self->{repo_id}, $ref_id, 1);
2248+
$gs = Git::SVN->init($u, $p, $repo_id, $ref_id, 1);
22482249
}
22492250
my ($r0, $parent) = $gs->find_rev_before($r, 1);
22502251
if (!defined $r0 || !defined $parent) {

t/t9121-git-svn-fetch-renamed-dir.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2008 Santhosh Kumar Mani
4+
5+
6+
test_description='git-svn can fetch renamed directories'
7+
8+
. ./lib-git-svn.sh
9+
10+
test_expect_success 'load repository with renamed directory' "
11+
svnadmin load -q $rawsvnrepo < ../t9121/renamed-dir.dump
12+
"
13+
14+
test_expect_success 'init and fetch repository' "
15+
git svn init $svnrepo/newname &&
16+
git svn fetch
17+
"
18+
19+
test_done
20+

t/t9121/renamed-dir.dump

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
SVN-fs-dump-format-version: 2
2+
3+
UUID: 06b9b3ad-f546-4fbe-8328-fcb4e6ef5c3f
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+
2008-04-02T09:11:59.778557Z
13+
PROPS-END
14+
15+
Revision-number: 1
16+
Prop-content-length: 117
17+
Content-length: 117
18+
19+
K 7
20+
svn:log
21+
V 14
22+
initial import
23+
K 10
24+
svn:author
25+
V 8
26+
santhosh
27+
K 8
28+
svn:date
29+
V 27
30+
2008-04-02T09:13:03.170863Z
31+
PROPS-END
32+
33+
Node-path: name
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: name/a.txt
43+
Node-kind: file
44+
Node-action: add
45+
Prop-content-length: 71
46+
Text-content-length: 6
47+
Text-content-md5: b1946ac92492d2347c6235b4d2611184
48+
Content-length: 77
49+
50+
K 13
51+
svn:mime-type
52+
V 10
53+
text/plain
54+
K 13
55+
svn:eol-style
56+
V 2
57+
LF
58+
PROPS-END
59+
hello
60+
61+
62+
Revision-number: 2
63+
Prop-content-length: 109
64+
Content-length: 109
65+
66+
K 7
67+
svn:log
68+
V 7
69+
renamed
70+
K 10
71+
svn:author
72+
V 8
73+
santhosh
74+
K 8
75+
svn:date
76+
V 27
77+
2008-04-02T09:14:22.952186Z
78+
PROPS-END
79+
80+
Node-path: newname
81+
Node-kind: dir
82+
Node-action: add
83+
Node-copyfrom-rev: 1
84+
Node-copyfrom-path: name
85+
86+
87+
Node-path: name
88+
Node-action: delete
89+
90+

0 commit comments

Comments
 (0)