Re: [PATCH 3/3] notes: don't indent empty lines
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Aug 30, 2021, 17:41 UTC
- Message-ID
- <CAPig+cQ6FA0rUnkkTDRUD5vAD3cDXW9vtR1oX0pUJK5eJB9CHg@mail.gmail.com>
- In-Reply-To
- <xmqqwno2505w.fsf@gitster.g>
On Mon, Aug 30, 2021 at 1:10 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 13 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes: > > Like other Git commands, `git notes` takes care to call `stripspace` on > > the user-supplied note content, thereby ensuring that it has no trailing > > whitespace, among other cleanups. However, when notes are inserted into > > a patch via `git format-patch --notes`, all lines of the note are > > indented unconditionally, including empty lines, which leaves trailing > > whitespace on lines which previously were empty, thus negating the > > normalization done earlier. Fix this shortcoming. > > Playing the devil's advocate, it can be argued that using the same > leading whitespace on a paragraph break line is actually a good > thing. Leaving them in would give the consumer an easy way to see > which part was inserted from a note.
The, um, angel's response: `git format-patch --notes` is a convenience for the _submitter_ of a series. It is difficult to imagine a scenario[1] in which the _consumer_ of a series would care or need to know whether patch commentary was written by hand, inserted mechanically (by `--notes`), or inserted mechanically and then hand-edited.
The trailing whitespace is unusual within the Git sphere, as well as unsightly if you happen to have your editor configured to highlight trailing whitespace, and just "feels" sloppy.
[1]: I suppose mechanical extraction of notes may be one such scenario, allowing for simple-minded (not necessarily robust) extraction mechanics; i.e. start extracting after the /^Notes:$/ line and stop at the first line not indented with four blanks.