{"thread":{"id":"31426","subject":"GIT-SVN: Corrupted commits when using --preserve-empty-dirs","startedAt":"2012-09-04T13:11:05Z","lastAt":"2012-09-06T21:02:08Z","messageCount":2,"participants":["Mark Plomer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"198302","messageId":"2086BD14B0971B4492C5AA17E9604CB02173C9C1@AMSPRD0610MB350.eurprd06.prod.outlook.com","threadId":"31426","inReplyTo":null,"subject":"GIT-SVN: Corrupted commits when using --preserve-empty-dirs","fromName":"Mark Plomer","fromEmail":"mark.plomer@boerse-go.de","sentAt":"2012-09-04T13:11:05Z","receivedAt":"2012-09-04T13:11:05Z","isPatch":false,"sender":{"key":"mark.plomer@boerse-go.de","avatar":null},"body":"Hi,\nif I clone a SVN repository with --preserve-empty-dirs it terminates at some point with i.e. following error:\nfolder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)\n\nI tracked things down to the following problem:\n- r1: Create a directory with subdirectory with a file\n- r2: Remove the file (so it generates a virtual .gitignore)\n- r3: Rename subdirectory\n- r4: Add a symlink named like the old subdirectory\n\n-> In GIT the symlink is actually not a symlink but a folder with the \".gitignore\" file ... which break things later when changing symlink\n\n\n# Simple reproduce script:\nsvnadmin create test-svn-repo\nsvn co file://`pwd`/test-svn-repo test-svn-wc\n\nmkdir -p test-svn-wc/folder/subfolder\ntouch test-svn-wc/folder/subfolder/file.txt\nsvn add test-svn-wc/*\nsvn ci -m 'Initial commit' test-svn-wc\n\nsvn rm test-svn-wc/folder/subfolder/file.txt\nsvn ci -m 'Removed file.txt' test-svn-wc\n\nsvn up test-svn-wc\nsvn mv test-svn-wc/folder/subfolder test-svn-wc/folder/subfolder2\nsvn ci -m 'Renamed subfolder' test-svn-wc\n\nsvn up test-svn-wc\nln -s subfolder2 test-svn-wc/folder/subfolder\nsvn add test-svn-wc/folder/subfolder\nsvn ci -m 'Added subfolder symlink' test-svn-wc\n\nrm -f test-svn-wc/folder/subfolder\nln -s changedlink test-svn-wc/folder/subfolder\nsvn ci -m 'Changed symlink' test-svn-wc\n\n\ngit svn clone --preserve-empty-dirs file://`pwd`/test-svn-repo test-git\n# this throws error: folder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)\n\n\nTested with git 1.7.12, svn 1.6.12 (debian)\n\nGreets Mark\n"},{"id":"198479","messageId":"50490F50.3020208@boerse-go.de","threadId":"31426","inReplyTo":"2086BD14B0971B4492C5AA17E9604CB02173C9C1@AMSPRD0610MB350.eurprd06.prod.outlook.com","subject":"Re: GIT-SVN: Corrupted commits when using --preserve-empty-dirs","fromName":"Mark Plomer","fromEmail":"mark.plomer@boerse-go.de","sentAt":"2012-09-06T21:02:08Z","receivedAt":"2012-09-06T21:02:08Z","isPatch":false,"sender":{"key":"mark.plomer@boerse-go.de","avatar":null},"body":"There is a strange workaround for SVN-repos, containing directories that \nwere replaced by symlinks in the past, properly cloned into GIT (with \nempty dirs):\n\nYou have to import it part-by-part ... i.e. fetch revision 1-3 and then \nfetch 4-5:\n\ngit svn clone -r 1:3 --preserve-empty-dirs file://`pwd`/test-svn-repo \ntest-git\ncd test-git\ngit svn fetch\n# This works fine for the example below\n\nThe disadvantage is, that you have to figure out those critical \nrevisions manually. Otherwise you may have an inconsistent clone.\n\nAm 04.09.2012 15:11, schrieb Mark Plomer:\n> Hi,\n> if I clone a SVN repository with --preserve-empty-dirs it terminates at some point with i.e. following error:\n> folder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)\n>\n> I tracked things down to the following problem:\n> - r1: Create a directory with subdirectory with a file\n> - r2: Remove the file (so it generates a virtual .gitignore)\n> - r3: Rename subdirectory\n> - r4: Add a symlink named like the old subdirectory\n>\n> -> In GIT the symlink is actually not a symlink but a folder with the \".gitignore\" file ... which break things later when changing symlink\n>\n>\n> # Simple reproduce script:\n> svnadmin create test-svn-repo\n> svn co file://`pwd`/test-svn-repo test-svn-wc\n>\n> mkdir -p test-svn-wc/folder/subfolder\n> touch test-svn-wc/folder/subfolder/file.txt\n> svn add test-svn-wc/*\n> svn ci -m 'Initial commit' test-svn-wc\n>\n> svn rm test-svn-wc/folder/subfolder/file.txt\n> svn ci -m 'Removed file.txt' test-svn-wc\n>\n> svn up test-svn-wc\n> svn mv test-svn-wc/folder/subfolder test-svn-wc/folder/subfolder2\n> svn ci -m 'Renamed subfolder' test-svn-wc\n>\n> svn up test-svn-wc\n> ln -s subfolder2 test-svn-wc/folder/subfolder\n> svn add test-svn-wc/folder/subfolder\n> svn ci -m 'Added subfolder symlink' test-svn-wc\n>\n> rm -f test-svn-wc/folder/subfolder\n> ln -s changedlink test-svn-wc/folder/subfolder\n> svn ci -m 'Changed symlink' test-svn-wc\n>\n>\n> git svn clone --preserve-empty-dirs file://`pwd`/test-svn-repo test-git\n> # this throws error: folder/subfolder was not found in commit 2dcb008c220f5f6fe33700c9e7deb0c8fa2b8607 (r4)\n>\n>\n> Tested with git 1.7.12, svn 1.6.12 (debian)\n>\n> Greets Mark\n"}]}