summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f23d1f7)
raw | patch | inline | side by side (parent: f23d1f7)
author | Gerrit Pape <pape@smarden.org> | |
Mon, 3 Mar 2008 09:22:03 +0000 (09:22 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 3 Mar 2008 21:38:30 +0000 (13:38 -0800) |
git-merge used to use either the --squash,--no-squash, --no-ff,--ff,
--no-commit,--commit option, whichever came last in the command line.
This lead to some un-intuitive behavior, having
git merge --no-commit --no-ff <branch>
actually commit the merge. Now git-merge respects --no-commit together
with --no-ff, as well as other combinations of the options. However,
this broke a selftest in t/t7600-merge.sh which expected to have --no-ff
completely override the --squash option, so that
git merge --squash --no-ff <branch>
fast-forwards, and makes a merge commit; combining --squash with --no-ff
doesn't really make sense though, and is now refused by git-merge. The
test is adapted to test --no-ff without the preceding --squash, and
another test is added to make sure the --squash --no-ff combination is
refused.
The unexpected behavior was reported by John Goerzen through
http://bing.sdebian.org/468568
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
--no-commit,--commit option, whichever came last in the command line.
This lead to some un-intuitive behavior, having
git merge --no-commit --no-ff <branch>
actually commit the merge. Now git-merge respects --no-commit together
with --no-ff, as well as other combinations of the options. However,
this broke a selftest in t/t7600-merge.sh which expected to have --no-ff
completely override the --squash option, so that
git merge --squash --no-ff <branch>
fast-forwards, and makes a merge commit; combining --squash with --no-ff
doesn't really make sense though, and is now refused by git-merge. The
test is adapted to test --no-ff without the preceding --squash, and
another test is added to make sure the --squash --no-ff combination is
refused.
The unexpected behavior was reported by John Goerzen through
http://bing.sdebian.org/468568
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-merge.sh | patch | blob | history | |
t/t7600-merge.sh | patch | blob | history |
diff --git a/git-merge.sh b/git-merge.sh
index 1c123a37e6941b6727c6101bb29cbc485a380c20..03cd39873aef7b7ce00c4c2a826eab867ecc29ac 100755 (executable)
--- a/git-merge.sh
+++ b/git-merge.sh
allow_fast_forward=t
allow_trivial_merge=t
+squash= no_commit=
dropsave() {
rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
--summary)
show_diffstat=t ;;
--squash)
- allow_fast_forward=t squash=t no_commit=t ;;
+ test "$allow_fast_forward" = t ||
+ die "You cannot combine --squash with --no-ff."
+ squash=t no_commit=t ;;
--no-squash)
- allow_fast_forward=t squash= no_commit= ;;
+ squash= no_commit= ;;
--commit)
- allow_fast_forward=t squash= no_commit= ;;
+ no_commit= ;;
--no-commit)
- allow_fast_forward=t squash= no_commit=t ;;
+ no_commit=t ;;
--ff)
- allow_fast_forward=t squash= no_commit= ;;
+ allow_fast_forward=t ;;
--no-ff)
- allow_fast_forward=false squash= no_commit= ;;
+ test "$squash" != t ||
+ die "You cannot combine --squash with --no-ff."
+ allow_fast_forward=f ;;
-s|--strategy)
shift
case " $all_strategies " in
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index 50c51c82facdf30fffa4517763c84ce862aa8c27..5d166280cbb93ef4e22f04090d510bfd5b09fb7a 100755 (executable)
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
test_expect_success 'merge c0 with c1 (no-ff)' '
git reset --hard c0 &&
+ git config branch.master.mergeoptions "" &&
test_tick &&
git merge --no-ff c1 &&
verify_merge file result.1 &&
test_debug 'gitk --all'
+test_expect_success 'combining --squash and --no-ff is refused' '
+ test_must_fail git merge --squash --no-ff c1 &&
+ test_must_fail git merge --no-ff --squash c1
+'
+
test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
git reset --hard c0 &&
git config branch.master.mergeoptions "--no-ff" &&