git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier

From
IBIlya Basin <basinilya@gmail.com>
Date
Apr 28, 2013, 08:35 UTC
Message-ID
<1611408441.20130428123541@gmail.com>

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
Message 1 of 1 in “git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlier”
  1. 2/2 git-svn: fix svn fetch erroneously recreating empty dir placeholder deleted earlierIlya Basin, Apr 28, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.