diff options
Diffstat (limited to 't/t3431-rebase-fork-point.sh')
-rwxr-xr-x | t/t3431-rebase-fork-point.sh | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/t/t3431-rebase-fork-point.sh b/t/t3431-rebase-fork-point.sh index 2dab893c75..4c98d99e7e 100755 --- a/t/t3431-rebase-fork-point.sh +++ b/t/t3431-rebase-fork-point.sh @@ -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 |