From c07eee1f2ab9e9b168e050c0ef0b48d039c71470 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 19 Jun 2006 17:59:35 -0700 Subject: 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 Signed-off-by: Junio C Hamano --- contrib/git-svn/git-svn.perl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'contrib/git-svn/git-svn.perl') diff --git a/contrib/git-svn/git-svn.perl b/contrib/git-svn/git-svn.perl index da0ff9ad8a..7e7f2f0cd9 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); -- cgit v1.2.3