Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup
flat view
From: Eric Sunshine <hidden>
Date: 2021-03-01 23:34:59
On Mon, Mar 1, 2021 at 3:50 AM Charvi Mendiratta [off-list ref] wrote:
quoted hunk ↗ jump to 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>`. Signed-off-by: Charvi Mendiratta <redacted> ---diff --git a/builtin/commit.c b/builtin/commit.c@@ -1186,6 +1186,27 @@ static void finalize_deferred_config(struct wt_status *s) +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); + if (patch_interactive) + die(_("cannot combine reword option of --fixup with --patch")); + if (interactive) + die(_("cannot combine reword option of --fixup with --interactive")); + if (all) + die(_("cannot combine reword option of --fixup with --all")); + if (also) + die(_("cannot combine reword option of --fixup with --include")); + if (only) + die(_("cannot combine reword option of --fixup with --only")); +}
Or, more concisely:
if (argc)
die(_("--fixup mutually exclusive with path '%s'), ...);
if (patch_interactive || interactive || all || also || only)
die(_("--fixup mutually exclusive with
--patch/--interactive/--all/--include/--only);
The mix of two different error message styles (capitalized with
full-stop vs. lowercase no-full-stop) is a bit jarring, but minor.
Not worth re-roll.