mirror of
https://github.com/git/git.git
synced 2024-05-10 15:26:09 +02:00
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>
This commit is contained in:
parent
e09f1254c5
commit
0af38890ad
|
@ -295,11 +295,11 @@ See also INCOMPATIBLE OPTIONS below.
|
||||||
empty after rebasing (because they contain a subset of already
|
empty after rebasing (because they contain a subset of already
|
||||||
upstream changes). With drop (the default), commits that
|
upstream changes). With drop (the default), commits that
|
||||||
become empty are dropped. With keep, such commits are kept.
|
become empty are dropped. With keep, such commits are kept.
|
||||||
With ask (implied by `--interactive`), the rebase will halt when
|
With ask, the rebase will halt when an empty commit is applied
|
||||||
an empty commit is applied allowing you to choose whether to
|
allowing you to choose whether to drop it, edit files more, or just
|
||||||
drop it, edit files more, or just commit the empty changes.
|
commit the empty changes.
|
||||||
Other options, like `--exec`, will use the default of drop unless
|
When the `-i`/`--interactive` option is used, the default becomes ask.
|
||||||
`-i`/`--interactive` is explicitly specified.
|
Otherwise, when the `--exec` option is used, the default becomes keep.
|
||||||
+
|
+
|
||||||
Note that commits which start empty are kept (unless `--no-keep-empty`
|
Note that commits which start empty are kept (unless `--no-keep-empty`
|
||||||
is specified), and commits which are clean cherry-picks (as determined
|
is specified), and commits which are clean cherry-picks (as determined
|
||||||
|
|
|
@ -167,4 +167,42 @@ test_expect_success 'rebase --merge does not leave state laying around' '
|
||||||
test_path_is_missing .git/MERGE_MSG
|
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
|
test_done
|
||||||
|
|
Loading…
Reference in New Issue