]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t3431-rebase-fork-point.sh
Merge branch 'ah/rebase-no-fork-point-config'
[thirdparty/git.git] / t / t3431-rebase-fork-point.sh
index 2dab893c759b288cefeb0d4b35ac4f4eb82b2eae..4c98d99e7e87476811877b4685f2f5a5eefe0f35 100755 (executable)
@@ -29,19 +29,23 @@ test_expect_success setup '
        test_commit G
 '
 
+do_test_rebase () {
+       expected="$1" &&
+       shift &&
+       git checkout main &&
+       git reset --hard E &&
+       git checkout side &&
+       git reset --hard G &&
+       git rebase $* &&
+       test_write_lines $expected >expect &&
+       git log --pretty=%s >actual &&
+       test_cmp expect actual
+}
+
 test_rebase () {
        expected="$1" &&
        shift &&
-       test_expect_success "git rebase $*" "
-               git checkout main &&
-               git reset --hard E &&
-               git checkout side &&
-               git reset --hard G &&
-               git rebase $* &&
-               test_write_lines $expected >expect &&
-               git log --pretty=%s >actual &&
-               test_cmp expect actual
-       "
+       test_expect_success "git rebase $*" "do_test_rebase '$expected' $*"
 }
 
 test_rebase 'G F E D B A'
@@ -77,4 +81,35 @@ test_expect_success 'git rebase --fork-point with ambigous refname' '
        test_must_fail git rebase --fork-point --onto D one
 '
 
+test_expect_success '--fork-point and --root both given' '
+       test_must_fail git rebase --fork-point --root 2>err &&
+       test_i18ngrep "cannot combine" err
+'
+
+test_expect_success 'rebase.forkPoint set to false' '
+       test_config rebase.forkPoint false &&
+       do_test_rebase "G F C E D B A"
+'
+
+test_expect_success 'rebase.forkPoint set to false and then to true' '
+       test_config_global rebase.forkPoint false &&
+       test_config rebase.forkPoint true &&
+       do_test_rebase "G F E D B A"
+'
+
+test_expect_success 'rebase.forkPoint set to false and command line says --fork-point' '
+       test_config rebase.forkPoint false &&
+       do_test_rebase "G F E D B A" --fork-point
+'
+
+test_expect_success 'rebase.forkPoint set to true and command line says --no-fork-point' '
+       test_config rebase.forkPoint true &&
+       do_test_rebase "G F C E D B A" --no-fork-point
+'
+
+test_expect_success 'rebase.forkPoint set to true and --root given' '
+       test_config rebase.forkPoint true &&
+       git rebase --root
+'
+
 test_done