threads / bug / 28065

[BUG] git-svn: error importing git repository in svn when first git commit was empty

Subject: [BUG] git-svn: error importing git repository in svn when first git commit was empty

## tl;dr

2 messages between Aug 11, 2011 and Aug 17, 2011.

replies: 1people: 2as markdown or json

s b· Aug 11, 2011, 09:13 UTC · lore

Couldn't find any bugtracker for git so I supposed it would be ok to post the bug here.

# Situation: I usually start my projects with git as it's quick and simple to track modifications. If the code grows and is of any interest for my work I push it to the corporate svn. I usually use this tutorial (http://eikke.com/importing-a-git-tree-into-a-subversion-repository/) which makes it a simple thing to do. Some time ago I started having a first empty commit in my git repository using 'git commit --allow-empty' as I read (can't remember where) it could help for some cases. I don't have need for those edge cases yet but remember thinking I could need them in the future.

# Problem: When your first git commit is empty, git-svn fails with the following message : $ git svn dcommit Committing to https://svn/repo/trunk ... No changes 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8~1 == 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8 No changes between current HEAD and refs/remotes/trunk Resetting to the latest refs/remotes/trunk Unable to extract revision information from commit 867ee195730507fb769e794eb4abe09d0e2e7c8f~1

At the same time, it also completely breaks the logs.
# How to reproduce: (the svn repository just has one commit for usual
trunk/branches/tags folders)
$ mkdir foobar
$ cd foobar/
$ git init
Initialized empty Git repository in /home/hr/tmp/foobar/.git/
$ git commit --allow-empty -m "Project init"
[master (root-commit) 0f1e71a] Project init
$ echo "foo" > test.txt; git add test.txt; git commit -m "Initial version"
[master 119fc0a] Initial version
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
$ echo "bar" > test.txt; git commit test.txt -m "Second version"
[master 77b2681] Second version
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git svn init -s https://code/svn/foobar/
$ git svn fetch
r1 = 8bc83d5d63b4191509d29aa90e35e24edba393c1 (refs/remotes/trunk)
$ git log --pretty=oneline master
77b268140a03cbe98215ea160704ba14ce79e096 Second version
119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version
0f1e71a283d7b4b27d23debaac091b654d495124 Project init
$ git show-ref trunk
8bc83d5d63b4191509d29aa90e35e24edba393c1 refs/remotes/trunk
$ echo "0f1e71a283d7b4b27d23debaac091b654d495124
8bc83d5d63b4191509d29aa90e35e24edba393c1" >> .git/info/grafts
$ git log --pretty=oneline
77b268140a03cbe98215ea160704ba14ce79e096 Second version
119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version
0f1e71a283d7b4b27d23debaac091b654d495124 Project init
8bc83d5d63b4191509d29aa90e35e24edba393c1 * Init project, mkdir trunk branches ta
$ git svn dcommit
Committing to https://code/svn/foobar/trunk ...
No changes
0f1e71a283d7b4b27d23debaac091b654d495124~1 ==
0f1e71a283d7b4b27d23debaac091b654d495124
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
Unable to extract revision information  from commit
119fc0a55d1eb851fcedfe0bdc6de3c1ab047601~1
$ git log
commit 8bc83d5d63b4191509d29aa90e35e24edba393c1
Author: root <root@e969a563-e91d-45ef-9946-abb13e32418c>
Date:   Thu Jul 7 06:40:59 2011 +0000
    * Init project, mkdir trunk branches tags.
    git-svn-id: https://code/svn/foobar/trunk@1 e969a563-e91d-45ef-9946-abb13e32

# Solution: Not really a solution but instead of using the first commit for the grafts, I use the second one (that is non empty).

Hope this can help getting a better git-svn!!
Stefan
-- 
Stefan Berder    Mail: sberder#gmail.com
 /(bb|[^b]{2})/
Michael J Gruber· Aug 17, 2011, 11:17 UTC · re: s b · lore

Re: [BUG] git-svn: error importing git repository in svn when first git commit was empty

s b venit, vidit, dixit 11.08.2011 11:13:
Show 26 quoted lines
> Couldn't find any bugtracker for git so I supposed it would be ok to
> post the bug here.
> 
> # Situation:
> I usually start my projects with git as it's quick and simple to track
> modifications. If the code grows and is of any interest for my work I
> push it to the corporate svn. I usually use this tutorial
> (http://eikke.com/importing-a-git-tree-into-a-subversion-repository/)
> which makes it a simple thing to do.
> Some time ago I started having a first empty commit in my git
> repository using 'git commit --allow-empty' as I read (can't remember
> where) it could help for some cases. I don't have need for those edge
> cases yet but remember thinking I could need them in the future.
> 
> # Problem:
> When your first git commit is empty, git-svn fails with the following message :
> $ git svn dcommit
> Committing to https://svn/repo/trunk ...
> No changes
> 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8~1 ==
> 71fb4051d840e27a43b87b071ccc7ea70bd0c5e8
> No changes between current HEAD and refs/remotes/trunk
> Resetting to the latest refs/remotes/trunk
> Unable to extract revision information  from commit
> 867ee195730507fb769e794eb4abe09d0e2e7c8f~1
> 
Shot in the dark (gray): Try
git svn dcommit --no-rebase
Show 58 quoted lines
> At the same time, it also completely breaks the logs.
> 
> # How to reproduce: (the svn repository just has one commit for usual
> trunk/branches/tags folders)
> $ mkdir foobar
> $ cd foobar/
> $ git init
> Initialized empty Git repository in /home/hr/tmp/foobar/.git/
> $ git commit --allow-empty -m "Project init"
> [master (root-commit) 0f1e71a] Project init
> $ echo "foo" > test.txt; git add test.txt; git commit -m "Initial version"
> [master 119fc0a] Initial version
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  create mode 100644 test.txt
> $ echo "bar" > test.txt; git commit test.txt -m "Second version"
> [master 77b2681] Second version
>  1 files changed, 1 insertions(+), 1 deletions(-)
> $ git svn init -s https://code/svn/foobar/
> $ git svn fetch
> r1 = 8bc83d5d63b4191509d29aa90e35e24edba393c1 (refs/remotes/trunk)
> $ git log --pretty=oneline master
> 77b268140a03cbe98215ea160704ba14ce79e096 Second version
> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version
> 0f1e71a283d7b4b27d23debaac091b654d495124 Project init
> $ git show-ref trunk
> 8bc83d5d63b4191509d29aa90e35e24edba393c1 refs/remotes/trunk
> $ echo "0f1e71a283d7b4b27d23debaac091b654d495124
> 8bc83d5d63b4191509d29aa90e35e24edba393c1" >> .git/info/grafts
> $ git log --pretty=oneline
> 77b268140a03cbe98215ea160704ba14ce79e096 Second version
> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601 Initial version
> 0f1e71a283d7b4b27d23debaac091b654d495124 Project init
> 8bc83d5d63b4191509d29aa90e35e24edba393c1 * Init project, mkdir trunk branches ta
> $ git svn dcommit
> Committing to https://code/svn/foobar/trunk ...
> No changes
> 0f1e71a283d7b4b27d23debaac091b654d495124~1 ==
> 0f1e71a283d7b4b27d23debaac091b654d495124
> No changes between current HEAD and refs/remotes/trunk
> Resetting to the latest refs/remotes/trunk
> Unable to extract revision information  from commit
> 119fc0a55d1eb851fcedfe0bdc6de3c1ab047601~1
> $ git log
> commit 8bc83d5d63b4191509d29aa90e35e24edba393c1
> Author: root <root@e969a563-e91d-45ef-9946-abb13e32418c>
> Date:   Thu Jul 7 06:40:59 2011 +0000
> 
>     * Init project, mkdir trunk branches tags.
> 
>     git-svn-id: https://code/svn/foobar/trunk@1 e969a563-e91d-45ef-9946-abb13e32
> 
> # Solution:
> Not really a solution but instead of using the first commit for the
> grafts, I use the second one (that is non empty).
> 
> Hope this can help getting a better git-svn!!
> 
> Stefan

← back to recent threads