Re: [PATCH 3/6] commit: add a reword suboption to --fixup
- From
Charvi Mendiratta <charvi077@gmail.com>
- Date
- Feb 18, 2021, 10:14 UTC
- Message-ID
- <CAPSFM5c0xFwnSh_O_8FRQSidQUMZWZs_f7kV8kXuCRYr0ro6rQ@mail.gmail.com>
- In-Reply-To
- <xmqqwnv6jwmz.fsf@gitster.g>
On Thu, 18 Feb 2021 at 01:26, Junio C Hamano <gitster@pobox.com> wrote: [...]
> The same comment applies to the above as an earlier step. >
Okay, will remove it.
Show 26 quoted lines
> > +static void check_fixup_reword_options(void) {
> > + 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 (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"));
> > +}
>
> Not just these options, wouldn't it be an error to ask to commit
> anything but an empty commit? E.g. shouldn't this sequence
>
> edit builtin/commit.c
> git commit --fixup=reword:HEAD~3 -- builtin/commit.c
>
> trigger an error, as we will *not* be taking any change made to the
> working tree file?
>
> Or is that implicitly covered by some other code?
>I admit this is a bug here. Thanks for pointing this out and will add the check for pathspec.