Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup
flat view
From: Junio C Hamano <hidden>
Date: 2021-03-01 18:45:20
Charvi Mendiratta [off-list ref] writes:
quoted hunk
`git commit --fixup=reword:<commit>` creates an empty "amend!" commit that will reword <commit> without changing its contents when it is rebased with --autosquash. Apart from ignoring staged changes it works similarly to `--fixup=amend:<commit>`. Mentored-by: Christian Couder [off-list ref] Mentored-by: Phillip Wood [off-list ref] Helped-by: Junio C Hamano [off-list ref] Signed-off-by: Charvi Mendiratta <redacted> --- 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 <email>' and matches no e...
commit.c: die(_("Invalid ignored mode '%s'"), ignored_arg);
commit.c: die(_("Invalid untracked files mode '%s'"), untrack...
...