aboutsummaryrefslogtreecommitdiffstats
path: root/t/t3424-rebase-empty.sh
diff options
context:
space:
mode:
authorBrian Lyles <brianmlyles@gmail.com>2024-03-25 18:16:48 -0500
committerJunio C Hamano <gitster@pobox.com>2024-03-25 16:45:40 -0700
commit0af38890ade347536af7690ecee9e5e75d1b2b12 (patch)
treec81f9abb06a7383a07497836f349021e0728400f /t/t3424-rebase-empty.sh
parente09f1254c54329773904fe25d7c545a1fb4fa920 (diff)
downloadgit-0af38890ade347536af7690ecee9e5e75d1b2b12.tar.gz
docs: address inaccurate `--empty` default with `--exec`
The documentation for git-rebase(1) indicates that using the `--exec` option will use `--empty=drop`. This is inaccurate: when `--interactive` is not explicitly provided, `--exec` results in `--empty=keep` behaviors. Correctly indicate the behavior of `--exec` using `--empty=keep` when `--interactive` is not specified. Reported-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Brian Lyles <brianmlyles@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3424-rebase-empty.sh')
-rwxr-xr-xt/t3424-rebase-empty.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/t3424-rebase-empty.sh b/t/t3424-rebase-empty.sh
index 5e1045a0af..73ff35ced2 100755
--- a/t/t3424-rebase-empty.sh
+++ b/t/t3424-rebase-empty.sh
@@ -167,4 +167,42 @@ test_expect_success 'rebase --merge does not leave state laying around' '
test_path_is_missing .git/MERGE_MSG
'
+test_expect_success 'rebase --exec --empty=drop' '
+ git checkout -B testing localmods &&
+ git rebase --exec "true" --empty=drop upstream &&
+
+ test_write_lines D C B A >expect &&
+ git log --format=%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'rebase --exec --empty=keep' '
+ git checkout -B testing localmods &&
+ git rebase --exec "true" --empty=keep upstream &&
+
+ test_write_lines D C2 C B A >expect &&
+ git log --format=%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'rebase --exec uses default of --empty=keep' '
+ git checkout -B testing localmods &&
+ git rebase --exec "true" upstream &&
+
+ test_write_lines D C2 C B A >expect &&
+ git log --format=%s >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'rebase --exec --empty=ask' '
+ git checkout -B testing localmods &&
+ test_must_fail git rebase --exec "true" --empty=ask upstream &&
+
+ git rebase --skip &&
+
+ test_write_lines D C B A >expect &&
+ git log --format=%s >actual &&
+ test_cmp expect actual
+'
+
test_done