From 33f2a3108eeacbd937021470aa6e67c01ceec960 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Mon, 7 Dec 2009 22:28:32 -0500 Subject: [PATCH] git svn: Don't create empty directories whose parents were deleted Commit 6111b93 "git svn: attempt to create empty dirs on clone+rebase" will create empty directories 'a/b' and 'a/c' if they were previously created in SVN, even if their parent directory 'a' was deleted. For example, unhandled.log may contain lines like this: r32 +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/acl +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/machine.d +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/moira-acl [...] r314 -empty_dir: packages/sipb-xen-remctl-auto [ew: rewrote to be line-wrapped at <= 80-columns] Reported-by: Evan Broder Signed-off-by: Greg Price Acked-by: Eric Wong --- git-svn.perl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/git-svn.perl b/git-svn.perl index 51f03adb9..bdd1f966c 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -2748,7 +2748,8 @@ sub mkemptydirs { } elsif (/^ \+empty_dir: (.+)$/) { $empty_dirs{$1} = 1; } elsif (/^ \-empty_dir: (.+)$/) { - delete $empty_dirs{$1}; + my @d = grep {m[^\Q$1\E(/|$)]} (keys %empty_dirs); + delete @empty_dirs{@d}; } } close $fh; -- 2.30.2