Re: [PATCH 2/6] commit: add amend suboption to --fixup to create amend! commit
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 18, 2021, 19:18 UTC
- Message-ID
- <xmqqpn0xfal8.fsf@gitster.g>
- In-Reply-To
- <CAPSFM5ddkALLCU+k+Th=pvKHEaarr_45DSn=N5DCJu1o7_5-Eg@mail.gmail.com>
Charvi Mendiratta <charvi077@gmail.com> writes:
Show 15 quoted lines
> Hi Junio, > > On Thu, 18 Feb 2021 at 01:20, Junio C Hamano <gitster@pobox.com> wrote: > [...] >> The second one, even with s|HEAD|HEAD~3| is even less clear. >> Without the "-m", the resulting commit will have the subject that >> begins with !amend but the log message body is taken from the given >> commit, but with "-m", what happens? Does a single-liner 'clever >> commit message' _replace_ the log message of the named commit, >> resulting in an !amend commit that has no message from the original? >> Or does 'clever commit message' get _appended_ the log message? >> > > Yes, here it gets _appended_ the log message. I agree this seems a bit > confusing.
In what situation would a user use "-m 'appended pieces of text'" option, together with "--fixup=amend:<commit>"? I am wondering if we want such a "append to" feature, or is it easier to understand for end-users if "-m", "-F", "-C" and "-c" (the common trait of these options is that they contribute to the log message text) are made incompatible with --fixup=amend:<commit>.
> ...Thanks, for pointing this out. Also, in the above method for > alnum I think we can initialize an array of alnum[] instead of > alphas[]. Or otherwise I was thinking to instead check: > if (!isalnum(*c) && *c == ':')
Sure a loop is fine, or alnum[] is fine, or just alpha[] is OK, I would think. Do you foresee you'd need --fixup=chomp124:<commit>? I somehow doubt it.