{"thread":{"id":"28065","subject":"[BUG] git-svn: error importing git repository in svn when first git commit was empty","startedAt":"2011-08-11T09:13:24Z","lastAt":"2011-08-17T11:17:19Z","messageCount":2,"participants":["s b","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"173266","messageId":"CAAzBVjAjqr8hDFdMc2s6d=ZXttswSnLiig-aFKsZG5EJjAyAig@mail.gmail.com","threadId":"28065","inReplyTo":null,"subject":"[BUG] git-svn: error importing git repository in svn when first git commit was empty","fromName":"s b","fromEmail":"sberder@gmail.com","sentAt":"2011-08-11T09:13:24Z","receivedAt":"2011-08-11T09:13:24Z","isPatch":false,"sender":{"key":"sberder@gmail.com","avatar":null},"body":"Couldn't find any bugtracker for git so I supposed it would be ok to\npost the bug here.\n\n# Situation:\nI usually start my projects with git as it's quick and simple to track\nmodifications. If the code grows and is of any interest for my work I\npush it to the corporate svn. I usually use this tutorial\n(http://eikke.com/importing-a-git-tree-into-a-subversion-repository/)\nwhich makes it a simple thing to do.\nSome time ago I started having a first empty commit in my git\nrepository using 'git commit --allow-empty' as I read (can't remember\nwhere) it could help for some cases. I don't have need for those edge\ncases yet but remember thinking I could need them in the future.\n\n# Problem:\nWhen your first git commit is empty, git-svn fails with the following message :\n$ git svn dcommit\nCommitting to https://svn/repo/trunk ...\nNo changes\n71fb4051d840e27a43b87b071ccc7ea70bd0c5e8~1 ==\n71fb4051d840e27a43b87b071ccc7ea70bd0c5e8\nNo changes between current HEAD and refs/remotes/trunk\nResetting to the latest refs/remotes/trunk\nUnable to extract revision information  from commit\n867ee195730507fb769e794eb4abe09d0e2e7c8f~1\n\nAt the same time, it also completely breaks the logs.\n\n# How to reproduce: (the svn repository just has one commit for usual\ntrunk/branches/tags folders)\n$ mkdir foobar\n$ cd foobar/\n$ git init\nInitialized empty Git repository in /home/hr/tmp/foobar/.git/\n$ git commit --allow-empty -m \"Project init\"\n[master (root-commit) 0f1e71a] Project init\n$ echo \"foo\" > test.txt; git add test.txt; git commit -m \"Initial version\"\n[master 119fc0a] Initial version\n 1 files changed, 1 insertions(+), 0 deletions(-)\n create mode 100644 test.txt\n$ echo \"bar\" > test.txt; git commit test.txt -m \"Second version\"\n[master 77b2681] Second version\n 1 files changed, 1 insertions(+), 1 deletions(-)\n$ git svn init -s https://code/svn/foobar/\n$ git svn fetch\nr1 = 8bc83d5d63b4191509d29aa90e35e24edba393c1 (refs/remotes/trunk)\n$ git log --pretty=oneline master\n77b268140a03cbe98215ea160704ba14ce79e096 Second version\n119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version\n0f1e71a283d7b4b27d23debaac091b654d495124 Project init\n$ git show-ref trunk\n8bc83d5d63b4191509d29aa90e35e24edba393c1 refs/remotes/trunk\n$ echo \"0f1e71a283d7b4b27d23debaac091b654d495124\n8bc83d5d63b4191509d29aa90e35e24edba393c1\" >> .git/info/grafts\n$ git log --pretty=oneline\n77b268140a03cbe98215ea160704ba14ce79e096 Second version\n119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version\n0f1e71a283d7b4b27d23debaac091b654d495124 Project init\n8bc83d5d63b4191509d29aa90e35e24edba393c1 * Init project, mkdir trunk branches ta\n$ git svn dcommit\nCommitting to https://code/svn/foobar/trunk ...\nNo changes\n0f1e71a283d7b4b27d23debaac091b654d495124~1 ==\n0f1e71a283d7b4b27d23debaac091b654d495124\nNo changes between current HEAD and refs/remotes/trunk\nResetting to the latest refs/remotes/trunk\nUnable to extract revision information  from commit\n119fc0a55d1eb851fcedfe0bdc6de3c1ab047601~1\n$ git log\ncommit 8bc83d5d63b4191509d29aa90e35e24edba393c1\nAuthor: root <root@e969a563-e91d-45ef-9946-abb13e32418c>\nDate:   Thu Jul 7 06:40:59 2011 +0000\n\n    * Init project, mkdir trunk branches tags.\n\n    git-svn-id: https://code/svn/foobar/trunk@1 e969a563-e91d-45ef-9946-abb13e32\n\n# Solution:\nNot really a solution but instead of using the first commit for the\ngrafts, I use the second one (that is non empty).\n\nHope this can help getting a better git-svn!!\n\nStefan\n-- \nStefan Berder    Mail: sberder#gmail.com\n /(bb|[^b]{2})/\n"},{"id":"173670","messageId":"4E4BA33F.8060103@drmicha.warpmail.net","threadId":"28065","inReplyTo":"CAAzBVjAjqr8hDFdMc2s6d=ZXttswSnLiig-aFKsZG5EJjAyAig@mail.gmail.com","subject":"Re: [BUG] git-svn: error importing git repository in svn when first git commit was empty","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2011-08-17T11:17:19Z","receivedAt":"2011-08-17T11:17:19Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"s b venit, vidit, dixit 11.08.2011 11:13:\n> Couldn't find any bugtracker for git so I supposed it would be ok to\n> post the bug here.\n> \n> # Situation:\n> I usually start my projects with git as it's quick and simple to track\n> modifications. If the code grows and is of any interest for my work I\n> push it to the corporate svn. I usually use this tutorial\n> (http://eikke.com/importing-a-git-tree-into-a-subversion-repository/)\n> which makes it a simple thing to do.\n> Some time ago I started having a first empty commit in my git\n> repository using 'git commit --allow-empty' as I read (can't remember\n> where) it could help for some cases. I don't have need for those edge\n> cases yet but remember thinking I could need them in the future.\n> \n> # Problem:\n> When your first git commit is empty, git-svn fails with the following message :\n> $ git svn dcommit\n> Committing to https://svn/repo/trunk ...\n> No changes\n> 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8~1 ==\n> 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8\n> No changes between current HEAD and refs/remotes/trunk\n> Resetting to the latest refs/remotes/trunk\n> Unable to extract revision information  from commit\n> 867ee195730507fb769e794eb4abe09d0e2e7c8f~1\n> \n\nShot in the dark (gray): Try\n\ngit svn dcommit --no-rebase\n\n> At the same time, it also completely breaks the logs.\n> \n> # How to reproduce: (the svn repository just has one commit for usual\n> trunk/branches/tags folders)\n> $ mkdir foobar\n> $ cd foobar/\n> $ git init\n> Initialized empty Git repository in /home/hr/tmp/foobar/.git/\n> $ git commit --allow-empty -m \"Project init\"\n> [master (root-commit) 0f1e71a] Project init\n> $ echo \"foo\" > test.txt; git add test.txt; git commit -m \"Initial version\"\n> [master 119fc0a] Initial version\n>  1 files changed, 1 insertions(+), 0 deletions(-)\n>  create mode 100644 test.txt\n> $ echo \"bar\" > test.txt; git commit test.txt -m \"Second version\"\n> [master 77b2681] Second version\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> $ git svn init -s https://code/svn/foobar/\n> $ git svn fetch\n> r1 = 8bc83d5d63b4191509d29aa90e35e24edba393c1 (refs/remotes/trunk)\n> $ git log --pretty=oneline master\n> 77b268140a03cbe98215ea160704ba14ce79e096 Second version\n> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version\n> 0f1e71a283d7b4b27d23debaac091b654d495124 Project init\n> $ git show-ref trunk\n> 8bc83d5d63b4191509d29aa90e35e24edba393c1 refs/remotes/trunk\n> $ echo \"0f1e71a283d7b4b27d23debaac091b654d495124\n> 8bc83d5d63b4191509d29aa90e35e24edba393c1\" >> .git/info/grafts\n> $ git log --pretty=oneline\n> 77b268140a03cbe98215ea160704ba14ce79e096 Second version\n> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version\n> 0f1e71a283d7b4b27d23debaac091b654d495124 Project init\n> 8bc83d5d63b4191509d29aa90e35e24edba393c1 * Init project, mkdir trunk branches ta\n> $ git svn dcommit\n> Committing to https://code/svn/foobar/trunk ...\n> No changes\n> 0f1e71a283d7b4b27d23debaac091b654d495124~1 ==\n> 0f1e71a283d7b4b27d23debaac091b654d495124\n> No changes between current HEAD and refs/remotes/trunk\n> Resetting to the latest refs/remotes/trunk\n> Unable to extract revision information  from commit\n> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601~1\n> $ git log\n> commit 8bc83d5d63b4191509d29aa90e35e24edba393c1\n> Author: root <root@e969a563-e91d-45ef-9946-abb13e32418c>\n> Date:   Thu Jul 7 06:40:59 2011 +0000\n> \n>     * Init project, mkdir trunk branches tags.\n> \n>     git-svn-id: https://code/svn/foobar/trunk@1 e969a563-e91d-45ef-9946-abb13e32\n> \n> # Solution:\n> Not really a solution but instead of using the first commit for the\n> grafts, I use the second one (that is non empty).\n> \n> Hope this can help getting a better git-svn!!\n> \n> Stefan\n"}]}