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

2 messages, 2 authors, 2021-01-22 · open the first message on its own page

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

From: Junio C Hamano <hidden>
Date: 2021-01-21 21:00:40

Christian Couder [off-list ref] writes:
quoted
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".
Yeah, it uses pretty.c::skip_blank_lines(), which is easy to use.
so something like a loop that calls skip_blank_lines() to see if it
returns a differnt result (which means the argument we fed it was at
the beginning of a blank line, which is what this helper wants to
return), and otherwise we advance by one line with strchrnul() and
retry, perhaps.

    while (*body) {
	char *next = skip_blank_lines(body);
	if (next != body)
	    break; /* found a blank line */
	body = strchrnul(body, '\n');
	if (*body)
	    body++;
    }
    /* body has the answer */

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

From: Charvi Mendiratta <hidden>
Date: 2021-01-22 22:46:56

On Fri, 22 Jan 2021 at 02:26, Junio C Hamano [off-list ref] wrote:
Christian Couder [off-list ref] writes:
quoted
quoted
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".
Yeah, it uses pretty.c::skip_blank_lines(), which is easy to use.
so something like a loop that calls skip_blank_lines() to see if it
returns a differnt result (which means the argument we fed it was at
the beginning of a blank line, which is what this helper wants to
return), and otherwise we advance by one line with strchrnul() and
retry, perhaps.

    while (*body) {
        char *next = skip_blank_lines(body);
        if (next != body)
            break; /* found a blank line */
        body = strchrnul(body, '\n');
        if (*body)
            body++;
    }
    /* body has the answer */
Thanks for all the pointers. I took time in looking into it, but now I got more
cleared its actually looks for all the spaces in complete line which
is considered
as a blank line and above function explains it more clearly. I will
update the "subject
length" function as the above way and send in the next revision.

Thanks and Regards,
Charvi
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help