From: Fabien POTENCIER <fabien.potencier@gmail.com>
To: git@vger.kernel.org
Subject: A possible subtree split bug
Date: Tue, 31 Jul 2012 13:21:20 +0200 [thread overview]
Message-ID: <5017BFB0.9070701@gmail.com> (raw)
Hi all,
I've encountered what I think is a bug in the subtree split command
included in contrib.
According to the docs:
"Repeated splits of exactly the same history are
guaranteed to be identical (ie. to produce the same
commit ids). Because of this, if you add new commits
and then re-split, the new commits will be attached as
commits on top of the history you generated last time..."
But unfortunately, that's not always the case.
I've found that if you have a commit that reverts the previous one and
then merge a branch where those two commits did not exist, then the next
time you split, they won't be present anymore in the split tree.
Here is a simple script that exhibits the issue:
#!/bin/sh
git init
# create a directory that is going to be split
mkdir doc
echo "TEST" > doc/README
git add doc
# commit A
git ci -a -m"first version"
# create a branch with a new commit (Z)
git co -b test
echo "TEST" > doc/README1
git add doc/README1
git ci -a -m"added README1"
git co master
# modify the README file (commit B)
echo "TEST_" > doc/README
git ci -a -m"second version"
# revert the change (commit C)
echo "TEST" > doc/README
git ci -a -m"revert second version"
# split
git subtree split --prefix="doc" --branch=TARGET
# the log will show the 3 commits as expected (including B and C)
git log --oneline TARGET
# merge the test branch
git merge -m"merged test" test
# re-split
# deleting the target as the bug prevents the split to happen correctly
git branch -D TARGET
git subtree split --prefix="doc" --branch=TARGET
# the 2 commits B and C are not in the split anymore
# the split will only show A then Z which is not the expected result
git log --oneline TARGET
Fabien
--
Fabien Potencier
Sensio CEO - Symfony lead developer
sensiolabs.com | symfony.com | fabien.potencier.org
Tél: +33 1 40 99 80 80
next reply other threads:[~2012-07-31 11:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 11:21 Fabien POTENCIER [this message]
2012-08-21 1:48 ` A possible subtree split bug greened
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=5017BFB0.9070701@gmail.com \
--to=fabien.potencier@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.