git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya Basin <basinilya@gmail.com>
To: Git mailing list <git@vger.kernel.org>
Subject: [PATCH 2/2] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier
Date: Sun, 28 Apr 2013 12:35:41 +0400	[thread overview]
Message-ID: <1611408441.20130428123541@gmail.com> (raw)

The Fetcher accumulates deleted paths in an array and doesn't reset the
array on next commit. This causes different results when interrupting
and resuming the fetch.
When --preserve-empty-dirs flag is used, a path in the array can be
erroneously treated as just deleted, although it was deleted in the
previous commit and cause the creation of an empty dir placeholder.

Test script:

    (
    set -e

    rm -rf testrepo.svn testrepo.gitsvn
    svnadmin create testrepo.svn
    url=file://`pwd`/testrepo.svn

    rm -rf testrepo
    svn co "$url" testrepo
    cd testrepo

    mkdir -p foo/bar
    echo aaa > foo/bar/fil.txt
    svn add foo
    svn commit -mx

    svn rm -mx "$url/foo/bar/fil.txt"
    svn rm -mx "$url/foo/bar"

    echo aaa > fil.txt
    svn add fil.txt
    svn commit -mx

    cd ..

    rm -rf testrepo.gitsvn && git svn clone --preserve-empty-dirs "$url" testrepo.gitsvn

    if [ -e testrepo.gitsvn/foo/bar/.gitignore ]; then
      echo "error: testrepo.gitsvn/foo/bar/.gitignore exists"
      false
    fi
    )
---
 perl/Git/SVN/Fetcher.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/perl/Git/SVN/Fetcher.pm b/perl/Git/SVN/Fetcher.pm
index 4f96076..e658889 100644
--- a/perl/Git/SVN/Fetcher.pm
+++ b/perl/Git/SVN/Fetcher.pm
@@ -19,6 +19,7 @@ sub new {
 	my ($class, $git_svn, $switch_path) = @_;
 	my $self = SVN::Delta::Editor->new;
 	bless $self, $class;
+	@deleted_gpath = ();
 	if (exists $git_svn->{last_commit}) {
 		$self->{c} = $git_svn->{last_commit};
 		$self->{empty_symlinks} =
-- 
1.8.1.5

                 reply	other threads:[~2013-04-28  8:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1611408441.20130428123541@gmail.com \
    --to=basinilya@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).