* Bug in git-svn: dcommit commits in the wrong branch after a rebase
@ 2007-08-08 21:35 Benoit SIGOURE
2007-08-09 15:45 ` Benoit SIGOURE
2007-08-09 15:46 ` Steven Grimm
0 siblings, 2 replies; 3+ messages in thread
From: Benoit SIGOURE @ 2007-08-08 21:35 UTC (permalink / raw)
To: git; +Cc: Eric Wong
[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]
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
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug in git-svn: dcommit commits in the wrong branch after a rebase
2007-08-08 21:35 Bug in git-svn: dcommit commits in the wrong branch after a rebase Benoit SIGOURE
@ 2007-08-09 15:45 ` Benoit SIGOURE
2007-08-09 15:46 ` Steven Grimm
1 sibling, 0 replies; 3+ messages in thread
From: Benoit SIGOURE @ 2007-08-09 15:45 UTC (permalink / raw)
To: git; +Cc: Eric Wong
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
On Aug 8, 2007, at 11:35 PM, Benoit SIGOURE wrote:
> 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'!
>
Actually the test case is wrong, it should end in:
git-rebase b # while being on `master' branch
git-svn dcommit # this works as expected
Thanks to siprbaum for spotting this on IRC. Sorry for the noise.
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bug in git-svn: dcommit commits in the wrong branch after a rebase
2007-08-08 21:35 Bug in git-svn: dcommit commits in the wrong branch after a rebase Benoit SIGOURE
2007-08-09 15:45 ` Benoit SIGOURE
@ 2007-08-09 15:46 ` Steven Grimm
1 sibling, 0 replies; 3+ messages in thread
From: Steven Grimm @ 2007-08-09 15:46 UTC (permalink / raw)
To: Benoit SIGOURE; +Cc: git, Eric Wong
Benoit SIGOURE wrote:
> 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'!
That's exactly what I would expect to happen. The "git-rebase" is the
key here; it is effectively telling git to switch back to your master
branch. Try running "git log" before and after the rebase command and
you should get a slightly better idea of what's happening. Rebase is
kind of a tricky beast; a basic rule of thumb is that you should only
use it to go forward in time on a single upstream branch, not to hop
between upstream branches. Its behavior in non-forward-in-time cases is
predictable once you know how it works, but not necessarily intuitive.
What are you expecting rebase to do here? We can probably suggest some
other commands that will do what you're hoping to do. My hunch is that
you're trying to use it to effectively do a merge of your "a" and "b"
branches, but maybe I'm wrong about that.
-Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-09 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 21:35 Bug in git-svn: dcommit commits in the wrong branch after a rebase Benoit SIGOURE
2007-08-09 15:45 ` Benoit SIGOURE
2007-08-09 15:46 ` Steven Grimm
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).