# Re: \[RFC PATCH 3/9\] rebase -i: comment out squash!/fixup! subjects from squash message

- From: Charvi Mendiratta \<hidden\>
- Date: 2021-01-15 11:13:43 
- List: git
- Page: https://ratatoskr.run/git/2021/01/7872438
- Thread: https://ratatoskr.run/git/2021/01/7871406/t.md

```text
Hi Christian,

On Fri, 15 Jan 2021 at 14:15, Christian Couder
[ref] wrote:
>
> Hi Charvi,
>
> On Fri, Jan 15, 2021 at 9:35 AM Charvi Mendiratta [ref] wrote:
>
> > On Thu, 14 Jan 2021 at 15:59, Phillip Wood [ref] wrote:
>
> > > On 14/01/2021 08:27, Charvi Mendiratta wrote:
> > > > On Thu, 14 Jan 2021 at 00:31, Taylor Blau [ref] wrote:
> > > >>
> > > >> On Fri, Jan 08, 2021 at 02:53:41PM +0530, Charvi Mendiratta wrote:
> > > >>> From: Phillip Wood <redacted>
>
> > > >>> +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;
> > > >>> +}
> > > >>
> > > >> OK, so this gets the length of the subject in "body", which is defined
> > > >> as the run of characters before a newline and then a space character.
> > >
> > > The length of the subject is the run of characters before a line
> > > containing only whitespace, "hello\n there" would return 13 "hello\n
> > > \nthere" would return 5. Looking again at my code there must be a way of
> > > writing that function that is easier to follow.
> >
> > Okay. I will look into it once, thanks for explaining.
>
> You may want to look at other places in the code where we deal with
> the subject. For example there is find_commit_subject() in commit.c
> and find_trailer_start() in trailer.c that might have interesting code
> for our purpose.
>

Thanks for the pointer, I will look at it.

Thanks and Regards,
Charvi

> Best,
> Christian.
```
