diff options
author | Alex Henrie <alexhenrie24@gmail.com> | 2021-02-23 10:18:40 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-24 22:49:10 +0300 |
commit | 2803d800d2268cde4b932fab38dffe6712d86d16 (patch) | |
tree | aae5cf2cb87a03428119bcce9fbb63d1fd2e53db /t | |
parent | 66e871b6647ffea61a77a0f82c7ef3415f1ee79c (diff) |
rebase: add a config option for --no-fork-point
Some users (myself included) would prefer to have this feature off by
default because it can silently drop commits.
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-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 172562789e..2d07bd9fd2 100755 --- a/t/t3431-rebase-fork-point.sh +++ b/t/t3431-rebase-fork-point.sh @@ -26,19 +26,23 @@ test_expect_success setup ' test_commit G ' +do_test_rebase () { + expected="$1" && + shift && + git checkout master && + 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 master && - 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' @@ -74,4 +78,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 |