Re: [PATCH v2 3/9] rebase -i: comment out squash!/fixup! subjects from squash message
- From
Christian Couder <christian.couder@gmail.com>
- Date
- Jan 21, 2021, 15:21 UTC
- Message-ID
- <CAP8UFD3PRaiCiSfSMaX0FDrEcOz2xv3992meum7qnKve1rK6nw@mail.gmail.com>
- In-Reply-To
- <CAPSFM5cxTrvAq6j3yhzidWdr8P8-sYmd1-9tmsK4iXMKrC7TNA@mail.gmail.com>
On Thu, Jan 21, 2021 at 3:02 PM Charvi Mendiratta <charvi077@gmail.com> wrote:
Show 32 quoted lines
>
> Hi Junio,
>
> On Thu, 21 Jan 2021 at 07:08, Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Charvi Mendiratta <charvi077@gmail.com> writes:
> >
> > > +static size_t subject_length(const char *body)
> > > +{
> > > + size_t i, len = 0;
> > > + char c;
> > > + int blank_line = 1;
> > > + for (i = 0, c = body[i]; c; c = body[++i]) {
> > > + if (c == '\n') {
> > > + if (blank_line)
> > > + return len;
> > > + len = i + 1;
> > > + blank_line = 1;
> > > + } else if (!isspace(c)) {
> > > + blank_line = 0;
> > > + }
> > > + }
> > > + return blank_line ? len : i;
> > > +}
> >
> > I cannot quite tell what this loop is trying to compute at the first
> > glance.
> >
>
> Oops, I think Phillip and Christian also pointed in the last revision
> to look for alternatives to make it easy. I mistook that point and
> forgot to look at it.Yes, please take a look at find_commit_subject() in "commit.c".
Show 17 quoted lines
> > > + grep "extra para" commit >actual && > > > > I can tell that you want the "extra para" to still remain, but how > > does the grep that is not anchored guarantee that? > > .. but now I think to remove this `grep -v "squash" commit` as also > discussed with Phillip earlier that in this test script we are not > checking for the commented commit message. > > > Perhaps look for > > > > grep "^extra para" commit > > > > to ensure that you are not seeing a commented out but somehow failed > > to get stripspaced out? > > > I am not sure, what does failing to get stripspaced mean?
I think this refers to:
https://git-scm.com/docs/git-stripspace
Best, Christian.