{"thread":{"id":"33660","subject":"[PATCH 2/2] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier","startedAt":"2013-04-28T08:35:41Z","lastAt":"2013-04-28T08:35:41Z","messageCount":1,"participants":["Ilya Basin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"215787","messageId":"1611408441.20130428123541@gmail.com","threadId":"33660","inReplyTo":null,"subject":"[PATCH 2/2] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier","fromName":"Ilya Basin","fromEmail":"basinilya@gmail.com","sentAt":"2013-04-28T08:35:41Z","receivedAt":"2013-04-28T08:35: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\nTest script:\n\n    (\n    set -e\n\n    rm -rf testrepo.svn testrepo.gitsvn\n    svnadmin create testrepo.svn\n    url=file://`pwd`/testrepo.svn\n\n    rm -rf testrepo\n    svn co \"$url\" testrepo\n    cd testrepo\n\n    mkdir -p foo/bar\n    echo aaa > foo/bar/fil.txt\n    svn add foo\n    svn commit -mx\n\n    svn rm -mx \"$url/foo/bar/fil.txt\"\n    svn rm -mx \"$url/foo/bar\"\n\n    echo aaa > fil.txt\n    svn add fil.txt\n    svn commit -mx\n\n    cd ..\n\n    rm -rf testrepo.gitsvn && git svn clone --preserve-empty-dirs \"$url\" testrepo.gitsvn\n\n    if [ -e testrepo.gitsvn/foo/bar/.gitignore ]; then\n      echo \"error: testrepo.gitsvn/foo/bar/.gitignore exists\"\n      false\n    fi\n    )\n---\n perl/Git/SVN/Fetcher.pm | 1 +\n 1 file changed, 1 insertion(+)\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} =\n-- \n1.8.1.5\n"}]}