Thread (5 messages) flat view 5 messages, 4 authors, 2021-01-22

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

From: Phillip Wood <hidden>
Date: 2021-01-21 16:59:27

Hi Christian and Charvi

On 21/01/2021 15:21, Christian Couder wrote:
On Thu, Jan 21, 2021 at 3:02 PM Charvi Mendiratta [off-list ref] wrote:
quoted
Hi Junio,

On Thu, 21 Jan 2021 at 07:08, Junio C Hamano [off-list ref] wrote:
quoted
Charvi Mendiratta [off-list ref] writes:
quoted
+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".
That looks like it is taking the commit header and finding the start of 
the message. We have just the message, I think we probably want to use 
format_subject() in pretty.c which does what my hard to follow code does 
with the option to replace newlines in the subject with another character.

Best Wishes

Phillip
quoted
quoted
quoted
+     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.
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help