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>
This commit is contained in:
Eric Wong
2006-06-19 17:59:35 -07:00
committed by Junio C Hamano
parent d281786fcd
commit c07eee1f2a
3 changed files with 41 additions and 6 deletions

View File

@ -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);