diff options
author | Phillip Wood <phillip.wood@dunelm.org.uk> | 2019-12-06 17:06:12 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-12-06 18:32:02 +0100 |
commit | 430b75f7209c554d88e3554eb54cebf4ba1e4608 (patch) | |
tree | 6745a135ed8abea555e14fe2d28a4805793b8531 /wt-status.h | |
parent | commit: encapsulate determine_whence() for sequencer (diff) | |
download | git-430b75f7209c554d88e3554eb54cebf4ba1e4608.tar.xz git-430b75f7209c554d88e3554eb54cebf4ba1e4608.zip |
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 or CHERRY_PICK_HEAD and REBASE_HEAD point to the same
commit , we still want to advise to use `git cherry-pick --skip`.
Original-patch-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.h')
-rw-r--r-- | wt-status.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/wt-status.h b/wt-status.h index e38e0942dc..73ab5d4da1 100644 --- a/wt-status.h +++ b/wt-status.h @@ -39,7 +39,8 @@ enum commit_whence { FROM_COMMIT, /* normal */ FROM_MERGE, /* commit came from merge */ FROM_CHERRY_PICK_SINGLE, /* commit came from cherry-pick */ - FROM_CHERRY_PICK_MULTI /* commit came from a sequence of cherry-picks */ + FROM_CHERRY_PICK_MULTI, /* commit came from a sequence of cherry-picks */ + FROM_REBASE_PICK /* commit came from a pick/reword/edit */ }; static inline int is_from_cherry_pick(enum commit_whence whence) @@ -48,6 +49,11 @@ static inline int is_from_cherry_pick(enum commit_whence whence) whence == FROM_CHERRY_PICK_MULTI; } +static inline int is_from_rebase(enum commit_whence whence) +{ + return whence == FROM_REBASE_PICK; +} + struct wt_status_change_data { int worktree_status; int index_status; |