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

Bug in git-svn: dcommit commits in the wrong branch after a rebase

From
Benoit SIGOURE <tsuna@lrde.epita.fr>
Date
Aug 8, 2007, 21:35 UTC
Message-ID
<21FC6D7F-5459-406D-AA06-D16E525B3C17@lrde.epita.fr>

Hi, I was working with Git on a SVN branch `a' (say my Git branch is `mya') and I wanted to create a new SVN branch `b' and dcommit my changes there for others (poor SVN users) to see. So I did a svn cp url://a url://b to create the branch `b' in SVN, git-svn fetch to import this branch, git checkout -b myb b and then rebased mya and then did a dcommit. Although the last commit at this point (in branch myb) had a svn-id "pointing to" the SVN branch b, dcommit sent the commits to the branch `a'.

Test case:

svnadmin create repos svn co file://`pwd`/repos wc cd wc svn mkdir branches svn mkdir branches/a echo foo >branches/a/foo svn add branches/a/foo svn ci -m 'branch a' cd .. git-svn clone --branches=branches file://`pwd`/repos wc.git cd wc.git echo git is cool >>foo git-commit -a -m 'commit in git in branch a' cd ../wc svn cp branches/a branches/b svn ci -m 'branch b' cd ../wc.git git-svn fetch git-checkout -b myb b git-rebase master git-svn dcommit # sends the commit to SVN branch `a' instead of SVN branch `b'!

Temporary workaround (in case someone finds this post after stumbling on this problem): svn mv branches/a branches/tmp <commit> svn mv branches/b branches/a <commit> svn mv branches/tmp branches/b <commit>

After this, git-svn fetch will slightly complain but it will work nevertheless.

Found possible branch point: url://repo/branches/a => url://repo/ branches/tmp, <N> Found branch parent: (b) <sha1> Following parent with do_switch Successfully followed parent r<N> = <sha1> (b) Found possible branch point: url://repo/branches/b => url://repo/ branches/a, <N+1> Found branch parent: (a) <sha1-X> Index mismatch: <sha1> != <sha1> rereading <sha1-X> Following parent with do_switch Successfully followed parent r<N+1> = <sha1> (a) [...]

Despite the `Index mismatch' sort of warning, the Git repo seems to be correct.

Cheers,
PS: I use git version 1.5.3.rc3.25.gf9208-dirty
-- 
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
Next: Benoit SIGOURE
Message 1 of 3 in “Bug in git-svn: dcommit commits in the wrong branch after a rebase”
  1. Benoit SIGOUREAug 8, 2007
  2. Benoit SIGOUREAug 9, 2007
  3. Steven GrimmAug 9, 2007

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.