{"thread":{"id":"21897","subject":"[PATCH] git svn: Don't create empty directories whose parents were deleted","startedAt":"2009-12-08T03:28:32Z","lastAt":"2009-12-08T04:59:26Z","messageCount":2,"participants":["Greg Price","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"129477","messageId":"20091208032831.GL30538@dr-wily.mit.edu","threadId":"21897","inReplyTo":null,"subject":"[PATCH] git svn: Don't create empty directories whose parents were deleted","fromName":"Greg Price","fromEmail":"price@ksplice.com","sentAt":"2009-12-08T03:28:32Z","receivedAt":"2009-12-08T03:28:32Z","isPatch":true,"sender":{"key":"price@mit.edu","avatar":"https://avatars.githubusercontent.com/u/28173?v=4"},"body":"Commit 6111b93 \"git svn: attempt to create empty dirs on clone+rebase\"\nwill create empty directories 'a/b' and 'a/c' if they were previously\ncreated in SVN, even if their parent directory 'a' was deleted.\n\nFor example, unhandled.log may contain lines like this:\n\nr32\n  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/acl\n  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/machine.d\n  +empty_dir: packages/sipb-xen-remctl-auto/sipb-xen-remctl-auto/files/etc/remctl/sipb-xen-auto/moira-acl\n[...]\nr314\n  -empty_dir: packages/sipb-xen-remctl-auto\n\nReported-by: Evan Broder <broder@mit.edu>\nSigned-off-by: Greg Price <price@ksplice.com>\n---\n\nThis is a regression in v1.6.6-rc0, so it would be good to fix before v1.6.6.\n\n git-svn.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 957d44e..5c35494 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -2748,7 +2748,7 @@ sub mkemptydirs {\n \t\t} elsif (/^  \\+empty_dir: (.+)$/) {\n \t\t\t$empty_dirs{$1} = 1;\n \t\t} elsif (/^  \\-empty_dir: (.+)$/) {\n-\t\t\tdelete $empty_dirs{$1};\n+\t\t\tdelete @empty_dirs{grep {m[^\\Q$1\\E(/|$)]} (keys %empty_dirs)};\n \t\t}\n \t}\n \tclose $fh;\n-- \n1.6.4.4\n"},{"id":"129480","messageId":"20091208045926.GA17683@dcvr.yhbt.net","threadId":"21897","inReplyTo":"20091208032831.GL30538@dr-wily.mit.edu","subject":"Re: [PATCH] git svn: Don't create empty directories whose parents were deleted","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-12-08T04:59:26Z","receivedAt":"2009-12-08T04:59:26Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Greg Price <price@ksplice.com> wrote:\n> This is a regression in v1.6.6-rc0, so it would be good to fix before v1.6.6.\n\nThanks Greg,\n\nI found another git svn bug (fixed in a patch below) while writing a\ntest case for this.\n\nJunio:\n\n  The following are pushed out to git://git.bogomips.org/git-svn and\n  should be ready for v1.6.6:\n\n    Alex Vandiver (1):\n          git-svn: sort svk merge tickets to account for minimal parents\n\n    Eric Wong (1):\n          git svn: log removals of empty directories\n\n    Greg Price (1):\n          git svn: Don't create empty directories whose parents were deleted\n\nThanks all\n\n>From f9ad77a739c0d012ee58b64eda2d7ec0d4e1df9d Mon Sep 17 00:00:00 2001\nFrom: Eric Wong <normalperson@yhbt.net>\nDate: Mon, 7 Dec 2009 20:49:38 -0800\nSubject: [PATCH] git svn: log removals of empty directories\n\nThis also adds a test case for:\n  \"git svn: Don't create empty directories whose parents were deleted\"\nwhich was the reason we found this bug in the first place.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl                  |    2 +-\n t/t9146-git-svn-empty-dirs.sh |   10 ++++++++++\n 2 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex bdd1f96..5a52068 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -3891,11 +3891,11 @@ sub delete_entry {\n \t\t}\n \t\tprint \"\\tD\\t$gpath/\\n\" unless $::_q;\n \t\tcommand_close_pipe($ls, $ctx);\n-\t\t$self->{empty}->{$path} = 0\n \t} else {\n \t\t$self->{gii}->remove($gpath);\n \t\tprint \"\\tD\\t$gpath\\n\" unless $::_q;\n \t}\n+\t$self->{empty}->{$path} = 0;\n \tundef;\n }\n \ndiff --git a/t/t9146-git-svn-empty-dirs.sh b/t/t9146-git-svn-empty-dirs.sh\nindex 70c52c1..9b8d046 100755\n--- a/t/t9146-git-svn-empty-dirs.sh\n+++ b/t/t9146-git-svn-empty-dirs.sh\n@@ -105,4 +105,14 @@ test_expect_success 'empty directories in trunk exist' '\n \t)\n '\n \n+test_expect_success 'remove a top-level directory from svn' '\n+\tsvn_cmd rm -m \"remove d\" \"$svnrepo\"/d\n+'\n+\n+test_expect_success 'removed top-level directory does not exist' '\n+\tgit svn clone \"$svnrepo\" removed &&\n+\ttest ! -e removed/d\n+\n+'\n+\n test_done\n-- \nEric Wong\n"}]}