]> granicus.if.org Git - git/commit
commit: give correct advice for empty commit during a rebase
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 22 Oct 2019 23:30:22 +0000 (23:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 23 Oct 2019 02:54:51 +0000 (11:54 +0900)
commit116a408b6ffcb2496ebf10dfce1364a42e8f0b32
treebcfb7826a3be71ead93ab53e56b632a9ff03c5f0
parent8eff6be23405aeda6d3a18f5a2e54c39196b273c
commit: give correct advice for empty commit during a rebase

In dcb500dc16c (cherry-pick/revert: advise using --skip, 2019-07-02),
`git commit` learned to suggest to run `git cherry-pick --skip` when
trying to cherry-pick an empty patch.

However, it was overlooked that there are more conditions than just a
`git cherry-pick` when this advice is printed (which originally
suggested the neutral `git reset`): the same can happen during a rebase.

Let's suggest the correct command, even during a rebase.

While at it, we adjust more places in `builtin/commit.c` that
incorrectly assumed that the presence of a `CHERRY_PICK_HEAD` meant that
surely this must be a `cherry-pick` in progress.

Note: we take pains to handle the situation when a user runs a `git
cherry-pick` _during_ a rebase. This is quite valid (e.g. in an `exec`
line in an interactive rebase). On the other hand, it is not possible to
run a rebase during a cherry-pick, meaning: if both `rebase-merge/` and
`sequencer/` exist, we still want to advise to use `git cherry-pick
--skip`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c
t/t3403-rebase-skip.sh