Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Mar 1, 2021, 22:36 UTC
- Message-ID
- <CAPig+cQR2ibdc1CQdwWKdk=mZM4FyaMsfw2Mpgk7Rdc-1R4PRQ@mail.gmail.com>
- In-Reply-To
- <20210301084512.27170-4-charvi077@gmail.com>
On Mon, Mar 1, 2021 at 3:50 AM Charvi Mendiratta <charvi077@gmail.com> wrote:
Show 31 quoted lines
> `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 <charvi077@gmail.com>
> ---
> 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.