git-svn: brown paper bag fixes
* avoid skipping modification-only changes in fetch * correctly fetch when we only have branches and tags to glob from (no fetch keys defined) Signed-off-by: Eric Wong <normalperson@yhbt.net>
Eric Wong committed
Feb 14, 2007 at 13:32 UTC
28710f74ea1f1d8a46c867ddd471dae3d7c3a664
2 files changed
+31
-2
git-svn.perl
+3
-2
@@ -782,7 +782,7 @@ sub fetch_all {
782
my $ra = Git::SVN::Ra->new($url);
783
my $uuid = $ra->get_uuid;
784
my $head = $ra->get_latest_revnum;
785
- my $base = $head;
785
+ my $base = defined $fetch ? $head : 0;
786
787
# read the max revs for wildcard expansion (branches/*, tags/*)
788
foreach my $t (qw/branches tags/) {
@@ -2901,7 +2901,8 @@ sub match_globs {
2901
}
2902
}
2903
foreach (keys %$paths) {
2904
- if (/$g->{path}->{left_regex}/) {
2904
+ if (/$g->{path}->{left_regex}/ &&
2905
+ !/$g->{path}->{regex}/) {
2906
next if $paths->{$_}->{action} !~ /^[AR]$/;
2907
get_dir_check($self, $exists, $g, $r);
2908
}
t/t9108-git-svn-glob.sh
+28
@@ -55,4 +55,32 @@ test_expect_success 'test refspec globbing' "
55
\"\`git rev-parse refs/remotes/trunk\`\"
56
"
57
58
+echo try to try > expect.two
59
+echo nothing to see here >> expect.two
60
+cat expect.end >> expect.two
61
+
62
+test_expect_success 'test left-hand-side only globbing' "
63
+ git config --add svn-remote.two.url $svnrepo &&
64
+ git config --add svn-remote.two.fetch trunk:refs/remotes/two/trunk &&
65
+ git config --add svn-remote.two.branches \
66
+ 'branches/*:refs/remotes/two/branches/*' &&
67
+ git config --add svn-remote.two.tags \
68
+ 'tags/*:refs/remotes/two/tags/*' &&
69
+ cd tmp &&
70
+ echo 'try try' >> tags/end/src/b/readme &&
71
+ poke tags/end/src/b/readme &&
72
+ svn commit -m 'try to try'
73
+ cd .. &&
74
+ git-svn fetch two &&
75
+ test \`git rev-list refs/remotes/two/tags/end | wc -l\` -eq 6 &&
76
+ test \`git rev-list refs/remotes/two/branches/start | wc -l\` -eq 3 &&
77
+ test \`git rev-parse refs/remotes/two/branches/start~2\` = \
78
+ \`git rev-parse refs/remotes/two/trunk\` &&
79
+ test \`git rev-parse refs/remotes/two/tags/end~3\` = \
80
+ \`git rev-parse refs/remotes/two/branches/start\` &&
81
+ git log --pretty=oneline refs/remotes/two/tags/end | \
82
+ sed -e 's/^.\{41\}//' > output.two &&
83
+ cmp expect.two output.two
84
+ "
85
+
86
test_done