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

Re: GIT-SVN: Corrupted commits when using --preserve-empty-dirs

From
MPMark Plomer <mark.plomer@boerse-go.de>
Date
Sep 6, 2012, 21:02 UTC
Message-ID
<50490F50.3020208@boerse-go.de>
In-Reply-To
<2086BD14B0971B4492C5AA17E9604CB02173C9C1@AMSPRD0610MB350.eurprd06.prod.outlook.com>

There is a strange workaround for SVN-repos, containing directories that were replaced by symlinks in the past, properly cloned into GIT (with empty dirs):

You have to import it part-by-part ... i.e. fetch revision 1-3 and then fetch 4-5:

git svn clone -r 1:3 --preserve-empty-dirs file://`pwd`/test-svn-repo test-git cd test-git git svn fetch # This works fine for the example below

The disadvantage is, that you have to figure out those critical revisions manually. Otherwise you may have an inconsistent clone.

Am 04.09.2012 15:11, schrieb Mark Plomer:
Show 46 quoted lines
> Hi,
> if I clone a SVN repository with --preserve-empty-dirs it terminates at some point with i.e. following error:
> folder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)
>
> I tracked things down to the following problem:
> - r1: Create a directory with subdirectory with a file
> - r2: Remove the file (so it generates a virtual .gitignore)
> - r3: Rename subdirectory
> - r4: Add a symlink named like the old subdirectory
>
> -> In GIT the symlink is actually not a symlink but a folder with the ".gitignore" file ... which break things later when changing symlink
>
>
> # Simple reproduce script:
> svnadmin create test-svn-repo
> svn co file://`pwd`/test-svn-repo test-svn-wc
>
> mkdir -p test-svn-wc/folder/subfolder
> touch test-svn-wc/folder/subfolder/file.txt
> svn add test-svn-wc/*
> svn ci -m 'Initial commit' test-svn-wc
>
> svn rm test-svn-wc/folder/subfolder/file.txt
> svn ci -m 'Removed file.txt' test-svn-wc
>
> svn up test-svn-wc
> svn mv test-svn-wc/folder/subfolder test-svn-wc/folder/subfolder2
> svn ci -m 'Renamed subfolder' test-svn-wc
>
> svn up test-svn-wc
> ln -s subfolder2 test-svn-wc/folder/subfolder
> svn add test-svn-wc/folder/subfolder
> svn ci -m 'Added subfolder symlink' test-svn-wc
>
> rm -f test-svn-wc/folder/subfolder
> ln -s changedlink test-svn-wc/folder/subfolder
> svn ci -m 'Changed symlink' test-svn-wc
>
>
> git svn clone --preserve-empty-dirs file://`pwd`/test-svn-repo test-git
> # this throws error: folder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)
>
>
> Tested with git 1.7.12, svn 1.6.12 (debian)
>
> Greets Mark
Previous: Mark Plomer
Message 2 of 2 in “GIT-SVN: Corrupted commits when using --preserve-empty-dirs”
  1. Mark PlomerSep 4, 2012
  2. Mark PlomerSep 6, 2012

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.