diff options
author | Eric Wong <normalperson@yhbt.net> | 2006-06-20 00:59:35 (GMT) |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-06-20 08:31:57 (GMT) |
commit | c07eee1f2ab9e9b168e050c0ef0b48d039c71470 (patch) | |
tree | d92fbf6458ffcd24f125c4fe9e2b946ecef485ea /contrib/git-svn/git-svn.perl | |
parent | d281786fcd6d0df47dd46e415f1a804b2e81ed9b (diff) | |
download | git-c07eee1f2ab9e9b168e050c0ef0b48d039c71470.zip git-c07eee1f2ab9e9b168e050c0ef0b48d039c71470.tar.gz git-c07eee1f2ab9e9b168e050c0ef0b48d039c71470.tar.bz2 |
git-svn: fix --rmdir when using SVN:: libraries
When tracking directories with nearly all of its files at
the most nested levels, --rmdir would accidentally go too
far when deleting.
Of course, we'll add a test for this condition, too.
Makefile: automatically run new tests as they appear in t/
Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'contrib/git-svn/git-svn.perl')
-rwxr-xr-x | contrib/git-svn/git-svn.perl | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl index da0ff9a..7e7f2f0 100755 --- a/contrib/git-svn/git-svn.perl +++ b/contrib/git-svn/git-svn.perl @@ -2841,13 +2841,20 @@ sub rmdirs { exec qw/git-ls-tree --name-only -r -z/, $self->{c} or croak $!; } local $/ = "\0"; + my @svn_path = split m#/#, $self->{svn_path}; while (<$fh>) { chomp; - $_ = $self->{svn_path} . '/' . $_; - my ($dn) = ($_ =~ m#^(.*?)/?(?:[^/]+)$#); - delete $rm->{$dn}; - last unless %$rm; + my @dn = (@svn_path, (split m#/#, $_)); + while (pop @dn) { + delete $rm->{join '/', @dn}; + } + unless (%$rm) { + close $fh; + return; + } } + close $fh; + my ($r, $p, $bat) = ($self->{r}, $self->{pool}, $self->{bat}); foreach my $d (sort { $b =~ tr#/#/# <=> $a =~ tr#/#/# } keys %$rm) { $self->close_directory($bat->{$d}, $p); |