diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-02-25 16:43:31 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-25 16:43:31 -0800 |
commit | 682bbad64d9afd438d9b293c18331c1018672fee (patch) | |
tree | 688ed7a3c73bfee2f8b5e9b68466c8a2e5331991 /t/t3431-rebase-fork-point.sh | |
parent | 628c13cceed408526df39dbbd4a0d00bc4f34803 (diff) | |
parent | 2803d800d2268cde4b932fab38dffe6712d86d16 (diff) | |
download | git-682bbad64d9afd438d9b293c18331c1018672fee.tar.gz |
Merge branch 'ah/rebase-no-fork-point-config'
"git rebase --[no-]fork-point" gained a configuration variable
rebase.forkPoint so that users do not have to keep specifying a
non-default setting.
* ah/rebase-no-fork-point-config:
rebase: add a config option for --no-fork-point
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 |