Re: [PATCH v2 5/9] commit: use enum value for multiple cherry-picks
From: Junio C Hamano <hidden>
Date: 2019-12-06 18:13:37
Phillip Wood [off-list ref] writes:
From: Phillip Wood <redacted> Add FROM_CHERRY_PICK_MULTI for a sequence of cherry-picks rather than using a separate variable. Signed-off-by: Phillip Wood <redacted> --- 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.
quoted hunk
... - 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.