Re: [PATCH v3 3/3] ref-filter: use pretty.c logic for trailers
- From
Hariom verma <hariom18599@gmail.com>
- Date
- Feb 7, 2021, 19:38 UTC
- Message-ID
- <CA+CkUQ9kHhbDVMru=pRO90o+k7cc_ykxN9JRFGMvoG3hkeGJpA@mail.gmail.com>
- In-Reply-To
- <xmqqh7mn91w2.fsf@gitster.c.googlers.com>
Hi,
On Sun, Feb 7, 2021 at 11:49 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 12 quoted lines
> > Hariom verma <hariom18599@gmail.com> writes: > > > 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.