From: Junio C Hamano Date: Mon, 01 Mar 2021 18:41:44 GMT Subject: Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup Message-ID: In-Reply-To: <20210301084512.27170-4-charvi077@gmail.com> Charvi Mendiratta writes: > `git commit --fixup=reword:` creates an empty "amend!" commit > that will reword without changing its contents when it is > rebased with --autosquash. > > Apart from ignoring staged changes it works similarly to > `--fixup=amend:`. > > Mentored-by: Christian Couder > Mentored-by: Phillip Wood > Helped-by: Junio C Hamano > Signed-off-by: Charvi Mendiratta > --- > builtin/commit.c | 44 ++++++++++++++++++++++++++++++++++++-------- > 1 file changed, 36 insertions(+), 8 deletions(-) > > diff --git a/builtin/commit.c b/builtin/commit.c > index 200ef83cc0..a4d18d96df 100644 > --- a/builtin/commit.c > +++ b/builtin/commit.c > @@ -1186,6 +1186,27 @@ static void finalize_deferred_config(struct wt_status *s) > s->ahead_behind_flags = AHEAD_BEHIND_FULL; > } > > +static void check_fixup_reword_options(int argc, const char *argv[]) { > + if (whence != FROM_COMMIT) { > + if (whence == FROM_MERGE) > + die(_("You are in the middle of a merge -- cannot reword.")); > + else if (is_from_cherry_pick(whence)) > + die(_("You are in the middle of a cherry-pick -- cannot reword.")); > + } > + if (argc) > + die(_("cannot combine reword option of --fixup with path %s"), *argv); I think our convention is to quote '%s' with a single-quote pair. See other error messages. commit.c: die_errno(_("could not read '%s'"), templat... commit.c: die_errno(_("could not open '%s'"), git_path_commit... commit.c: die(_("--author '%s' is not 'Name ' and matches no e... commit.c: die(_("Invalid ignored mode '%s'"), ignored_arg); commit.c: die(_("Invalid untracked files mode '%s'"), untrack... ...