git-svn: fetch tracks initial change with --follow-parent
We were still skipping path information from get_log if we are tracking /r9270/drunk/subversion/bindings/..., but got something like this in the log: A /r9270/drunk (from /r9270/trunk:14) Signed-off-by: Eric Wong <normalperson@yhbt.net>
This commit is contained in:
parent
5d3b7cd5fe
commit
289370578c
17
git-svn.perl
17
git-svn.perl
@ -1090,6 +1090,19 @@ sub revisions_eq {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub match_paths {
|
||||||
|
my ($self, $paths) = @_;
|
||||||
|
return 1 if $paths->{'/'};
|
||||||
|
$self->{path_regex} ||= qr/^\/\Q$self->{path}\E\/?/;
|
||||||
|
grep /$self->{path_regex}/, keys %$paths and return 1;
|
||||||
|
my $c = '';
|
||||||
|
foreach (split m#/#, $self->rel_path) {
|
||||||
|
$c .= "/$_";
|
||||||
|
return 1 if $paths->{$c};
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sub find_parent_branch {
|
sub find_parent_branch {
|
||||||
my ($self, $paths, $rev) = @_;
|
my ($self, $paths, $rev) = @_;
|
||||||
return undef unless $::_follow_parent;
|
return undef unless $::_follow_parent;
|
||||||
@ -2313,7 +2326,6 @@ sub gs_fetch_loop_common {
|
|||||||
if (my $last_commit = $gs->last_commit) {
|
if (my $last_commit = $gs->last_commit) {
|
||||||
$gs->assert_index_clean($last_commit);
|
$gs->assert_index_clean($last_commit);
|
||||||
}
|
}
|
||||||
$gs->{path_regex} = qr/^\/\Q$gs->{path}\E\/?/;
|
|
||||||
}
|
}
|
||||||
while (1) {
|
while (1) {
|
||||||
my @revs;
|
my @revs;
|
||||||
@ -2339,8 +2351,7 @@ sub gs_fetch_loop_common {
|
|||||||
my ($paths, $r) = @$_;
|
my ($paths, $r) = @$_;
|
||||||
foreach my $gs (@gs) {
|
foreach my $gs (@gs) {
|
||||||
if ($paths) {
|
if ($paths) {
|
||||||
grep /$gs->{path_regex}/, keys %$paths
|
$gs->match_paths($paths) or next;
|
||||||
or next;
|
|
||||||
}
|
}
|
||||||
next if defined $gs->rev_db_get($r);
|
next if defined $gs->rev_db_get($r);
|
||||||
if (my $log_entry = $gs->do_fetch($paths, $r)) {
|
if (my $log_entry = $gs->do_fetch($paths, $r)) {
|
||||||
|
@ -105,7 +105,7 @@ test_expect_success 'follow deleted directory' "
|
|||||||
|
|
||||||
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
|
# ref: r9270 of the Subversion repository: (http://svn.collab.net/repos/svn)
|
||||||
# in trunk/subversion/bindings/swig/perl
|
# in trunk/subversion/bindings/swig/perl
|
||||||
test_expect_success '' "
|
test_expect_success 'follow-parent avoids deleting relevant info' "
|
||||||
mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
|
mkdir -p import/trunk/subversion/bindings/swig/perl/t &&
|
||||||
for i in a b c ; do \
|
for i in a b c ; do \
|
||||||
echo \$i > import/trunk/subversion/bindings/swig/perl/\$i.pm &&
|
echo \$i > import/trunk/subversion/bindings/swig/perl/\$i.pm &&
|
||||||
@ -134,6 +134,18 @@ test_expect_success '' "
|
|||||||
\"\`git ls-tree --name-only r9270-t\`\"
|
\"\`git ls-tree --name-only r9270-t\`\"
|
||||||
"
|
"
|
||||||
|
|
||||||
|
test_expect_success "track initial change if it was only made to parent" "
|
||||||
|
svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk &&
|
||||||
|
git-svn init -i r9270-d \
|
||||||
|
$svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t &&
|
||||||
|
git-svn fetch -i r9270-d --follow-parent &&
|
||||||
|
test \`git rev-list r9270-d | wc -l\` -eq 3 &&
|
||||||
|
test \"\`git ls-tree --name-only r9270-t\`\" = \
|
||||||
|
\"\`git ls-tree --name-only r9270-d\`\" &&
|
||||||
|
test \"\`git rev-parse r9270-t\`\" = \
|
||||||
|
\"\`git rev-parse r9270-d~1\`\"
|
||||||
|
"
|
||||||
|
|
||||||
test_debug 'gitk --all &'
|
test_debug 'gitk --all &'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user