git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: About git reporting missing newline for symlinks

From
Philip Oakley <philipoakley@iee.email>
Date
Oct 13, 2022, 20:34 UTC
Message-ID
<aead3926-d87b-5fcd-4984-bb690f3fbf4e@iee.email>
In-Reply-To
<221013.8635brldj4.gmgdl@evledraar.gmail.com>
On 13/10/2022 20:33, Ævar Arnfjörð Bjarmason wrote:
Show 52 quoted lines
> On Thu, Oct 13 2022, Junio C Hamano wrote:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>>>> 	\ The filename pointed to by the symlink does not end in a newline
>>>> While I do not think it would break anybody, I doubt it would give
>>>> us much value.  One line above that output is a line that any user,
>>>> who is vaguely familiar with the contents being compared, can
>>>> recognize as giving a pathname, the contents of the symbolic link.
>>> Clearly it confused the initial reporter upthread :)
>> But to such a user, I highly suspect that the rephased message above
>> still looks like a warning, and will result in the same reaction.
>>
>> IOW, you want to explain why "does not end in a newline" is worth
>> expressing in the output.  Saying "does not end in a newline" alone
>> would tell the user what they already know (i.e. the symlink stores
>> the target filename without an extra LF at the end).
> Yes, but isn't the point of the report/confusion that we're inserting
> what looks like the warning you get when you forget a \n at the end of a
> source file, so a user might wonder why they're seeing it at all.
>
> Whereas what we're *really* doing there is not really about that at all,
> but just inserting a bit of magic so that the diff format & its
> consumers grok that this line we're inserting there isn't supposed to
> have a \n, as we're working with a filename.
>
> Maybe e.g.:
> 	
> 	diff --git a/RelNotes b/RelNotes
> 	index d505db645be..758368388a4 120000
> 	--- a/RelNotes
> 	+++ b/RelNotes
> 	@@ -1 +1 @@
> 	-Documentation/RelNotes/2.38.0.txt
> 	\ No newline at end of file
> 	+Documentation/RelNotes/2.39.0.txt
> 	\ No newline at end of file
>
> Would, for those users, be less confusing as:
>
> 	diff --git a/RelNotes b/RelNotes
> 	index d505db645be..758368388a4 120000
> 	--- a/RelNotes
> 	+++ b/RelNotes
> 	@@ -1 +1 @@
> 	-Documentation/RelNotes/2.38.0.txt
> 	\ The symlink above has no trailing NL in its filename
> 	+Documentation/RelNotes/2.39.0.txt
> 	\ The symlink above has no trailing NL in its filename
>
> *dunno* :)
> 	

Pondering on why it is thought of as a warning to be treated as an error, maybe the message implies something is missing via the negative "No" assertion, rather than simply being informative [1].

Perhaps swapping out the "No" and instead using something like "\ Without a newline at end of file" would better convey that it's just information about the file's format, and in no way a real problem. Just a thought. -- Philip [1] My comment in Git Users discussion: https://groups.google.com/d/msgid/git-users/c4f53bb2-cff6-4a76-8fa7-cd34ca88ce63n%40googlegroups.com <https://groups.google.com/d/msgid/git-users/c4f53bb2-cff6-4a76-8fa7-cd34ca88ce63n%40googlegroups.com?utm_medium=email&utm_source=footer>

Previous: Junio C HamanoNext: Erik Cervin Edin
Message 10 of 15 in “About git reporting missing newline for symlinks”
  1. Ignacio TarantoOct 12, 2022
  2. Junio C HamanoOct 12, 2022
  3. Ignacio TarantoOct 12, 2022
  4. Ævar Arnfjörð BjarmasonOct 13, 2022
  5. Junio C HamanoOct 13, 2022
  6. Ævar Arnfjörð BjarmasonOct 13, 2022
  7. Junio C HamanoOct 13, 2022
  8. Ævar Arnfjörð BjarmasonOct 13, 2022
  9. Junio C HamanoOct 13, 2022
  10. Philip OakleyOct 13, 2022
  11. Erik Cervin EdinOct 13, 2022
  12. brian m. carlsonOct 12, 2022
  13. Junio C HamanoOct 12, 2022
  14. brian m. carlsonOct 12, 2022
  15. Taylor BlauOct 13, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.