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.