{"thread":{"id":"33667","subject":"[PATCH 3/3] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier, try #2","startedAt":"2013-04-28T20:11:02Z","lastAt":"2013-04-28T20:11:02Z","messageCount":1,"participants":["Ilya Basin"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"215809","messageId":"991177798.20130429001102@gmail.com","threadId":"33667","inReplyTo":null,"subject":"[PATCH 3/3] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier, try #2","fromName":"Ilya Basin","fromEmail":"basinilya@gmail.com","sentAt":"2013-04-28T20:11:02Z","receivedAt":"2013-04-28T20:11:02Z","isPatch":true,"sender":{"key":"basinilya@gmail.com","avatar":null},"body":"The Fetcher accumulates deleted paths in an array and doesn't reset the\narray on next commit. This causes different results when interrupting\nand resuming the fetch.\nWhen --preserve-empty-dirs flag is used, a path in the array can be\nerroneously treated as just deleted (although it was deleted in the\nprevious commit) and cause the creation of an empty dir placeholder.\n---\n perl/Git/SVN/Fetcher.pm                |  1 +\n t/t9160-git-svn-preserve-empty-dirs.sh | 18 ++++++++++++++++--\n 2 files changed, 17 insertions(+), 2 deletions(-)\n\ndiff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm\nindex 4f96076..e658889 100644\n--- a/perl/Git/SVN/Fetcher.pm\n+++ b/perl/Git/SVN/Fetcher.pm\n@@ -19,6 +19,7 @@ sub new {\n \tmy ($class, $git_svn, $switch_path) = @_;\n \tmy $self = SVN::Delta::Editor->new;\n \tbless $self, $class;\n+\t@deleted_gpath = ();\n \tif (exists $git_svn->{last_commit}) {\n \t\t$self->{c} = $git_svn->{last_commit};\n \t\t$self->{empty_symlinks} =\ndiff --git a/t/t9160-git-svn-preserve-empty-dirs.sh b/t/t9160-git-svn-preserve-empty-dirs.sh\nindex 43b1852..d50314d 100755\n--- a/t/t9160-git-svn-preserve-empty-dirs.sh\n+++ b/t/t9160-git-svn-preserve-empty-dirs.sh\n@@ -15,18 +15,27 @@ say 'define NO_SVN_TESTS to skip git svn tests'\n GIT_REPO=git-svn-repo\n \n test_expect_success 'initialize source svn repo containing empty dirs' '\n+\t#exec 1>/dev/tty 2>&1\n \tsvn_cmd mkdir -m x \"$svnrepo\"/trunk &&\n \tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n \t(\n \t\tcd \"$SVN_TREE\" &&\n-\t\tmkdir -p 1 2 3/a 3/b 4 5 6 &&\n+\t\tmkdir -p 1 2 3/a 3/b 4 5 6 7 &&\n \t\techo \"First non-empty file\"  > 2/file1.txt &&\n \t\techo \"Second non-empty file\" > 2/file2.txt &&\n \t\techo \"Third non-empty file\"  > 3/a/file1.txt &&\n \t\techo \"Fourth non-empty file\" > 3/b/file1.txt &&\n-\t\tsvn_cmd add 1 2 3 4 5 6 &&\n+\t\techo \"x\" > 7/file.txt &&\n+\t\tsvn_cmd add 1 2 3 4 5 6 7 &&\n \t\tsvn_cmd commit -m \"initial commit\" &&\n \n+\t\tsvn_cmd del 7/file.txt &&\n+\t\tsvn_cmd commit -m \"delete last entry in directory\" &&\n+\t\tsvn_cmd up &&\n+\n+\t\tsvn_cmd del 7 &&\n+\t\tsvn_cmd commit -m \"delete empty dir that had files in it; subsequent commits should not recreate it\" &&\n+\n \t\tmkdir 4/a &&\n \t\tsvn_cmd add 4/a &&\n \t\tsvn_cmd commit -m \"nested empty directory\" &&\n@@ -60,6 +69,11 @@ test_expect_success 'clone svn repo with --preserve-empty-dirs --stdlayout' '\n \tgit svn clone \"$svnrepo\" --preserve-empty-dirs --stdlayout \"$GIT_REPO\"\n '\n \n+# \"$GIT_REPO\"/7/ should not be recreated\n+test_expect_success 'no recreating empty dir deleted earlier' '\n+\ttest_must_fail test -d \"$GIT_REPO\"/7/\n+'\n+\n # \"$GIT_REPO\"/1 should only contain the placeholder file.\n test_expect_success 'directory empty from inception' '\n \ttest -f \"$GIT_REPO\"/1/.gitignore &&\n-- \n1.8.1.5\n"}]}