From: sf <sf@b-i-t.de>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: BUG: rebase -p after cherry-pick does not work
Date: Mon, 18 Feb 2008 15:06:52 +0100 [thread overview]
Message-ID: <47B990FC.9090600@b-i-t.de> (raw)
Hello,
git-rebase -p does not work when one of the changes is cherry-picked
before rebase. Test case:
set -e -u
mkdir git
cd git
git init
for x in abc def ghi
do
echo $x >$x
git add $x
git commit -m$x
done
git branch first
git reset --hard first~2
git cherry-pick first^
git branch second
EDITOR=: git rebase --verbose --interactive --preserve-merges \
second first
git status
The result for me is:
Initialized empty Git repository in .git/
Created initial commit fc8b37c: abc
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 abc
Created commit 3d6ca20: def
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 def
Created commit 4c5e07a: ghi
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 ghi
HEAD is now at fc8b37c... abc
Finished one cherry-pick.
Created commit 3d6ca20: def
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 def
Switched to branch "first"
Note: moving to "3d6ca204f4823bde7273a4bb83676055ae415224" which isn't a
local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
git checkout -b <new_branch_name>
HEAD is now at 3d6ca20... def
Rebasing (1/1)
4c5e07a7107c87dec18244200ad1b52b76e71ea0
Fast forward to 4c5e07a7107c87dec18244200ad1b52b76e71ea0
Successfully rebased and updated refs/heads/first.
# On branch first
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: ghi
#
The problem area is function pick_one_preserving_merges in
git-rebase--interactive.sh:
# rewrite parents; if none were rewritten, we can fast-forward.
fast_forward=t
preserve=t
new_parents=
for p in $(git rev-list --parents -1 $sha1 | cut -d' ' -f2-)
do
if test -f "$REWRITTEN"/$p
then
preserve=f
new_p=$(cat "$REWRITTEN"/$p)
test $p != $new_p && fast_forward=f
case "$new_parents" in
*$new_p*)
;; # do nothing; that parent is already there
*)
new_parents="$new_parents $new_p"
;;
esac
fi
done
If a commit's parent is not applied during rebase (e.g. because it was
cherry-picked already) then it is not rewritten either.
Regards
Stephan
next reply other threads:[~2008-02-18 14:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-18 14:06 sf [this message]
2008-02-18 15:06 ` BUG: rebase -p after cherry-pick does not work Johannes Schindelin
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=47B990FC.9090600@b-i-t.de \
--to=sf@b-i-t.de \
--cc=Johannes.Schindelin@gmx.de \
--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.