From: Junio C Hamano Date: Sat, 3 Apr 2010 19:28:44 +0000 (-0700) Subject: Merge branch 'mb/rebase-i-no-ff' X-Git-Tag: v1.7.1-rc0~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9234b003726556e0d3d0ea8ade97dc9f7bd50a6e;p=git.git Merge branch 'mb/rebase-i-no-ff' * mb/rebase-i-no-ff: Teach rebase the --no-ff option. Conflicts: git-rebase--interactive.sh t/t3404-rebase-interactive.sh --- 9234b003726556e0d3d0ea8ade97dc9f7bd50a6e diff --cc git-rebase--interactive.sh index 2ff211cba,d5468b047..b817c4a76 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@@ -230,8 -224,8 +232,9 @@@ do_with_author () } pick_one () { - no_ff=$NEVER_FF - case "$1" in -n) sha1=$2; no_ff=t ;; *) sha1=$1 ;; esac + ff=--ff + case "$1" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac ++ case "$NEVER_FF" in '') ;; ?*) ff= ;; esac output git rev-parse --verify $sha1 || die "Invalid commit name: $sha1" test -d "$REWRITTEN" && pick_one_preserving_merges "$@" && return diff --cc t/t3404-rebase-interactive.sh index b0b43c6d3,624e78e98..f20ea3841 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@@ -553,37 -564,21 +564,54 @@@ test_expect_success 'reword' git show HEAD~2 | grep "C changed" ' +test_expect_success 'rebase -i can copy notes' ' + git config notes.rewrite.rebase true && + git config notes.rewriteRef "refs/notes/*" && + test_commit n1 && + test_commit n2 && + test_commit n3 && + git notes add -m"a note" n3 && + git rebase --onto n1 n2 && + test "a note" = "$(git notes show HEAD)" +' + +cat >expect < output && + test_cmp expect output +' + +test_expect_success 'rebase while detaching HEAD' ' + git symbolic-ref HEAD && + grandparent=$(git rev-parse HEAD~2) && + test_tick && + FAKE_LINES="2 1" git rebase -i HEAD~2 HEAD^0 && + test $grandparent = $(git rev-parse HEAD~2) && + test_must_fail git symbolic-ref HEAD +' + + test_tick # Ensure that the rebased commits get a different timestamp. + test_expect_success 'always cherry-pick with --no-ff' ' + git checkout no-ff-branch && + git tag original-no-ff-branch && + git rebase -i --no-ff A && + touch empty && + for p in 0 1 2 + do + test ! $(git rev-parse HEAD~$p) = $(git rev-parse original-no-ff-branch~$p) && + git diff HEAD~$p original-no-ff-branch~$p > out && + test_cmp empty out + done && + test $(git rev-parse HEAD~3) = $(git rev-parse original-no-ff-branch~3) && + git diff HEAD~3 original-no-ff-branch~3 > out && + test_cmp empty out + ' + test_done