Code

Merge branch 'js/rebase-detached'
[git.git] / t / t7600-merge.sh
index dec6ea2271106779ed6e04dabbb9ccb2a4fbe78c..6424c6e2c0b27f6d4dd19e9088710db932d2ace9 100755 (executable)
@@ -341,4 +341,100 @@ test_expect_success 'merge c1 with c2 and c3 (squash)' '
 
 test_debug 'gitk --all'
 
+test_expect_success 'merge c1 with c2 (no-commit in config)' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "--no-commit" &&
+       git merge c2 &&
+       verify_merge file result.1-5 &&
+       verify_head $c1 &&
+       verify_mergeheads $c2
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c1 with c2 (squash in config)' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "--squash" &&
+       git merge c2 &&
+       verify_merge file result.1-5 &&
+       verify_head $c1 &&
+       verify_no_mergehead &&
+       verify_diff squash.1-5 .git/SQUASH_MSG "[OOPS] bad squash message"
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'override config option -n' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "-n" &&
+       test_tick &&
+       git merge --summary c2 >diffstat.txt &&
+       verify_merge file result.1-5 msg.1-5 &&
+       verify_parents $c1 $c2 &&
+       if ! grep -e "^ file | \+2 +-$" diffstat.txt
+       then
+               echo "[OOPS] diffstat was not generated"
+       fi
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'override config option --summary' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "--summary" &&
+       test_tick &&
+       git merge -n c2 >diffstat.txt &&
+       verify_merge file result.1-5 msg.1-5 &&
+       verify_parents $c1 $c2 &&
+       if grep -e "^ file | \+2 +-$" diffstat.txt
+       then
+               echo "[OOPS] diffstat was generated"
+               false
+       fi
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c1 with c2 (override --no-commit)' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "--no-commit" &&
+       test_tick &&
+       git merge --commit c2 &&
+       verify_merge file result.1-5 msg.1-5 &&
+       verify_parents $c1 $c2
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c1 with c2 (override --squash)' '
+       git reset --hard c1 &&
+       git config branch.master.mergeoptions "--squash" &&
+       test_tick &&
+       git merge --no-squash c2 &&
+       verify_merge file result.1-5 msg.1-5 &&
+       verify_parents $c1 $c2
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c0 with c1 (no-ff)' '
+       git reset --hard c0 &&
+       test_tick &&
+       git merge --no-ff c1 &&
+       verify_merge file result.1 &&
+       verify_parents $c0 $c1
+'
+
+test_debug 'gitk --all'
+
+test_expect_success 'merge c0 with c1 (ff overrides no-ff)' '
+       git reset --hard c0 &&
+       git config branch.master.mergeoptions "--no-ff" &&
+       git merge --ff c1 &&
+       verify_merge file result.1 &&
+       verify_head $c1
+'
+
+test_debug 'gitk --all'
+
 test_done