{"thread":{"id":"33687","subject":"[PATCH 3/5] git-svn: fix fetch erroneously recreating empty dir placeholder deleted earlier, try #3","startedAt":"2013-04-30T10:04:41Z","lastAt":"2013-04-30T10:04:41Z","messageCount":1,"participants":["Ilya Basin"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"216026","messageId":"5180046e.6905700a.65c8.00b7@mx.google.com","threadId":"33687","inReplyTo":null,"subject":"[PATCH 3/5] git-svn: fix fetch erroneously recreating empty dir placeholder deleted earlier, try #3","fromName":"Ilya Basin","fromEmail":"basinilya@gmail.com","sentAt":"2013-04-30T10:04:41Z","receivedAt":"2013-04-30T10:04:41Z","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 | 13 +++++++++++++\n 2 files changed, 14 insertions(+)\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..ff06a86 100755\n--- a/t/t9160-git-svn-preserve-empty-dirs.sh\n+++ b/t/t9160-git-svn-preserve-empty-dirs.sh\n@@ -19,6 +19,12 @@ test_expect_success 'initialize source svn repo containing empty dirs' '\n \tsvn_cmd co \"$svnrepo\"/trunk \"$SVN_TREE\" &&\n \t(\n \t\tcd \"$SVN_TREE\" &&\n+\t\tmkdir -p module/foo module/bar &&\n+\t\techo x > module/foo/file.txt &&\n+\t\tsvn_cmd add module &&\n+\t\tsvn_cmd commit -mx &&\n+\t\tsvn_cmd mv module/foo/file.txt module/bar/file.txt &&\n+\t\tsvn_cmd commit -mx &&\n \t\tmkdir -p 1 2 3/a 3/b 4 5 6 &&\n \t\techo \"First non-empty file\"  > 2/file1.txt &&\n \t\techo \"Second non-empty file\" > 2/file2.txt &&\n@@ -44,6 +50,8 @@ test_expect_success 'initialize source svn repo containing empty dirs' '\n \t\tsvn_cmd del 3/b &&\n \t\tsvn_cmd commit -m \"delete non-last entry in directory\" &&\n \n+\t\tsvn_cmd rm -m\"x\" \"$svnrepo\"/trunk/module &&\n+\n \t\tsvn_cmd del 2/file1.txt &&\n \t\tsvn_cmd del 3/a &&\n \t\tsvn_cmd commit -m \"delete last entry in directory\" &&\n@@ -66,6 +74,11 @@ test_expect_success 'directory empty from inception' '\n \ttest $(find \"$GIT_REPO\"/1 -type f | wc -l) = \"1\"\n '\n \n+# \"$GIT_REPO\"/module/ should not be recreated\n+test_expect_success 'no recreating empty dir deleted earlier' '\n+\ttest_must_fail test -d \"$GIT_REPO\"/module/\n+'\n+\n # \"$GIT_REPO\"/2 and \"$GIT_REPO\"/3 should only contain the placeholder file.\n test_expect_success 'directory empty from subsequent svn commit' '\n \ttest -f \"$GIT_REPO\"/2/.gitignore &&\n-- \n1.8.1.5\n"}]}