author | Junio C Hamano <gitster@pobox.com> | |
Sat, 3 Apr 2010 19:28:44 +0000 (12:28 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 3 Apr 2010 19:28:44 +0000 (12:28 -0700) |
* mb/rebase-i-no-ff:
Teach rebase the --no-ff option.
Conflicts:
git-rebase--interactive.sh
t/t3404-rebase-interactive.sh
Teach rebase the --no-ff option.
Conflicts:
git-rebase--interactive.sh
t/t3404-rebase-interactive.sh
1 | 2 | |||
---|---|---|---|---|
git-rebase--interactive.sh | patch | | diff1 | | diff2 | | blob | history |
git-rebase.sh | patch | | diff1 | | diff2 | | blob | history |
t/t3404-rebase-interactive.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc git-rebase--interactive.sh
index 2ff211cbaa928275857577535f02ae92cb407f2f,d5468b047854f9992517c1c4c7a293e4cc320ddf..b817c4a76e54c31f5a21d8196729f0cfb31997cf
}
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 git-rebase.sh
Simple merge
diff --cc t/t3404-rebase-interactive.sh
index b0b43c6d329cacf24fd9ea6d69320e13d34b154c,624e78e982fd432ca9fe1f6482a0d27ef3adc685..f20ea38411d0ca67709dbde0bfd1108e28c0dd71
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 <<EOF
+an earlier note
+a note
+EOF
+
+test_expect_success 'rebase -i can copy notes over a fixup' '
+ git reset --hard n3 &&
+ git notes add -m"an earlier note" n2 &&
+ GIT_NOTES_REWRITE_MODE=concatenate FAKE_LINES="1 fixup 2" git rebase -i n1 &&
+ git notes show > 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