Re: [PATCH v3 3/6] commit: add a reword suboption to --fixup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 1, 2021 at 3:50 AM Charvi Mendiratta <charvi077@xxxxxxxxx> wrote:
> `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@xxxxxxxxx>
> ---
> 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.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux