Re: [PATCH v2 5/9] commit: use enum value for multiple cherry-picks
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 6, 2019, 18:13 UTC
- Message-ID
- <xmqq1rthxqyc.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20191206160614.631724-6-phillip.wood123@gmail.com>
Phillip Wood <phillip.wood123@gmail.com> writes:
Show 10 quoted lines
> From: Phillip Wood <phillip.wood@dunelm.org.uk> > > Add FROM_CHERRY_PICK_MULTI for a sequence of cherry-picks rather than > using a separate variable. > > Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> > --- > builtin/commit.c | 25 +++++++++++-------------- > wt-status.h | 9 ++++++++- > 2 files changed, 19 insertions(+), 15 deletions(-)
Makes sense. The checks have become quite pleasant to read, thanks to the new helper function.
Show 18 quoted lines
> ...
> - if (whence == FROM_CHERRY_PICK && !renew_authorship) {
> + if (is_from_cherry_pick(whence) && !renew_authorship) {
> author_message = "CHERRY_PICK_HEAD";
> author_message_buffer = read_commit_message(author_message);
> }
> diff --git a/wt-status.h b/wt-status.h
> index 64f1ddc9fd..0098fdb0b5 100644
> --- a/wt-status.h
> +++ b/wt-status.h
> @@ -39,9 +39,16 @@ enum show_ignored_type {
> enum commit_whence {
> FROM_COMMIT, /* normal */
> FROM_MERGE, /* commit came from merge */
> - FROM_CHERRY_PICK /* commit came from cherry-pick */
> + FROM_CHERRY_PICK_SINGLE, /* commit came from cherry-pick */
> + FROM_CHERRY_PICK_MULTI /* commit came from a sequence of cherry-picks */
> };It might be worth to end PICK_MULTI with a trailing comma to future-proof, but not worth a reroll for this alone.