Re: [PATCH v3 3/3] ref-filter: use pretty.c logic for trailers

2 messages, 2 authors, 2021-02-07 · open the first message on its own page

Re: [PATCH v3 3/3] ref-filter: use pretty.c logic for trailers

From: Junio C Hamano <hidden>
Date: 2021-02-07 18:20:40

Hariom verma [off-list ref] writes:
So this isn't about the patch series. Question still remains the same.
Thanks for digging the history.
Why extra blank line?
Let's dig a bit.
Ah. I guess I found the reason. It's due to `putchar('\n');` in
`show_ref_array_item() [1]`. It puts a new line after each ref item.

Do you want me to include a patch to get rid of this "extra blank
line" for trailers in "for-each-ref"?
I do not know the answer to the last question, because we haven't
learned the original reason why we decided to add the extra blank
line after the trailer output.  Even though I find it unnecessary,
the code that adds it must have been written with a good reason to
do so, and I do not want to see us remove the "\n" without knowing
that reason.

Thanks.

Re: [PATCH v3 3/3] ref-filter: use pretty.c logic for trailers

From: Hariom verma <hidden>
Date: 2021-02-07 19:39:22

Hi,

On Sun, Feb 7, 2021 at 11:49 PM Junio C Hamano [off-list ref] wrote:
Hariom verma [off-list ref] writes:
quoted
Do you want me to include a patch to get rid of this "extra blank
line" for trailers in "for-each-ref"?
I do not know the answer to the last question, because we haven't
learned the original reason why we decided to add the extra blank
line after the trailer output.  Even though I find it unnecessary,
the code that adds it must have been written with a good reason to
do so, and I do not want to see us remove the "\n" without knowing
that reason.
As per my understanding it works something like this:

print a ref item... put newline... print a ref item... put newline..
print a ref item... put newline... (so on)

But the catch is that trailer comes with a newline already included.
So it becomes:

print trailers with newline included... put newline... print trailers
with newline included... put newline.. (so on)

So we end up having 2 new lines in total.

we just can't directly remove the newline. but we introduce an option
to skip at will. Something like this?
https://github.com/harry-hov/git/commit/af75f5c9b0325af90831998f56d6f36b6baa928e

So we can turn off newline(extra) for trailers without disturbing
"for-each-ref"'s working.

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