git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: s b <sberder@gmail.com>
To: git@vger.kernel.org
Subject: [BUG] git-svn: error importing git repository in svn when first git commit was empty
Date: Thu, 11 Aug 2011 17:13:24 +0800	[thread overview]
Message-ID: <CAAzBVjAjqr8hDFdMc2s6d=ZXttswSnLiig-aFKsZG5EJjAyAig@mail.gmail.com> (raw)

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})/

             reply	other threads:[~2011-08-11  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11  9:13 s b [this message]
2011-08-17 11:17 ` [BUG] git-svn: error importing git repository in svn when first git commit was empty Michael J Gruber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAzBVjAjqr8hDFdMc2s6d=ZXttswSnLiig-aFKsZG5EJjAyAig@mail.gmail.com' \
    --to=sberder@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).