git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Eric Wong <normalperson@yhbt.net>
Cc: git@vger.kernel.org
Subject: git-svn messing up merge commits on dcommit
Date: Sun, 30 Aug 2009 03:32:25 +0200	[thread overview]
Message-ID: <20090830013225.GA6475@atjola.homenet> (raw)

[-- Attachment #1: Type: text/plain, Size: 1485 bytes --]

Hi Eric,

I have two "test cases" here (attached), which I actually wrote months
ago, but forgot to sent, as I wanted to clean them up/turn them into
something suitable for the test suite, but honestly, I'll probably never
get around to do that, so here they are, as they are. They show git-svn
messing up merge commits when dcommitting a branch that is not
up-to-date WRT the svn repo.

The basic history for both cases (before dcommit) is:

        C---D (master)
       /   /
      /---E (side)
     /
A---B (trunk)
     \
      X (revision in SVN, not yet fetched)

So the dcommit (which would send C and D to the svn repo) needs to
"rebase" C and D.

In the first test case, this rebasing causes conflicts, and leads to a
linearized history:

      E (side)
     /
A---B---X---C' (trunk)
             \
              D (master)

The merge is broken apart. This is probably expected, but I thought I'd
tell anyway.


The second test case is a bit more interesting, there are no conflicts
between the local commits to be dcommitted and the new commit X in the
svn repo. In this case, git-svn manages to dcommit the merge commit just
fine, keeping the history correct, but it messes the merge commit's
commit message up. So the history becomes:

A---B---X---C'--D' (trunk) (master)
     \         /
      --------E (side)

But D' has the same commit message as C/C', not the one from D.

I hope that makes any sense to you (or you can figure it out from the
testing scripts).

Björn

[-- Attachment #2: test --]
[-- Type: text/plain, Size: 582 bytes --]

#!/bin/sh
mkdir git-svn-test
cd git-svn-test

SVN="file://$PWD/svnrepo"
svnadmin create svnrepo
svn co "$SVN" co
cd co
svn mkdir trunk tags branches
svn ci -m init

echo 123 > trunk/foo
svn add trunk/foo
svn ci -m "SVN 1"

cd ..

git svn clone -s "$SVN" git

cd co
echo 456 >> trunk/foo
svn ci -m "SVN 2"
cd ..

cd git
git checkout -b side
echo 123 >> foo
git add foo
git commit -m "On side"
git checkout master
echo 123 > foo3
git add foo3
git commit -m "On master"
git merge --no-ff side
gitk --all&
git svn dcommit
echo resolved > foo
git add -u
git rebase --continue
gitk --all

[-- Attachment #3: test2 --]
[-- Type: text/plain, Size: 532 bytes --]

#!/bin/sh
mkdir git-svn-test
cd git-svn-test

SVN="file://$PWD/svnrepo"
svnadmin create svnrepo
svn co "$SVN" co
cd co
svn mkdir trunk tags branches
svn ci -m init

echo 123 > trunk/foo
svn add trunk/foo
svn ci -m "SVN 1"

cd ..

git svn clone -s "$SVN" git

cd co
echo 456 >> trunk/foo
svn ci -m "SVN 2"
cd ..

cd git
git checkout -b side
echo 123 >> foo2
git add foo2
git commit -m "On side"
git checkout master
echo 123 > foo3
git add foo3
git commit -m "On master"
git merge --no-ff side
gitk --all&
git svn dcommit
gitk --all&

             reply	other threads:[~2009-08-30  1:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-30  1:32 Björn Steinbrink [this message]
2009-08-31  1:37 ` git-svn messing up merge commits on dcommit Eric Wong

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=20090830013225.GA6475@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=normalperson@yhbt.net \
    /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).