From: Junio C Hamano <gitster@pobox.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Ignacio Taranto <ignacio.taranto@eclypsium.com>, git@vger.kernel.org
Subject: Re: About git reporting missing newline for symlinks
Date: Wed, 12 Oct 2022 14:34:55 -0700 [thread overview]
Message-ID: <xmqq35bsk9og.fsf@gitster.g> (raw)
In-Reply-To: <Y0cyX8Ggp+dkgAjX@tapette.crustytoothpaste.net> (brian m. carlson's message of "Wed, 12 Oct 2022 21:32:15 +0000")
"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> On 2022-10-12 at 21:17:04, Ignacio Taranto wrote:
>> So, both git diff and git show display "\ No newline at end of file"
>> for symlinks.
>>
>> I think this is related to how Git renders diffs, IMO it shouldn't
>> display a warning about
>> newlines for symlinks.
>>
>> Am I making any sense here?
>
> What Git shows for a symlink is the destination of the symlink. On
> Unix systems other than macOS, path names may contain any byte other
> than NUL, including a newline.
>
> While it obviously is not a good practice to include newlines in your
> paths, it is possible, and Git would not be able to round-trip symlinks
> where the final character of the destination is a newline if we didn't
> handle trailing newlines properly. As a result, we're not likely to
> change things here because it's required for correctness.
Just a fun thought experiment, but I wonder what would happen if a
user chooses to add .clean and .smudge filter that adds and strips
a LF at the end ;-)
next prev parent reply other threads:[~2022-10-12 21:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 21:17 About git reporting missing newline for symlinks Ignacio Taranto
2022-10-12 21:31 ` Junio C Hamano
2022-10-12 21:42 ` Ignacio Taranto
2022-10-13 13:11 ` Ævar Arnfjörð Bjarmason
2022-10-13 16:02 ` Junio C Hamano
2022-10-13 16:57 ` Ævar Arnfjörð Bjarmason
2022-10-13 18:50 ` Junio C Hamano
2022-10-13 19:33 ` Ævar Arnfjörð Bjarmason
2022-10-13 20:06 ` Junio C Hamano
2022-10-13 20:34 ` Philip Oakley
2022-10-13 22:01 ` Erik Cervin Edin
2022-10-12 21:32 ` brian m. carlson
2022-10-12 21:34 ` Junio C Hamano [this message]
2022-10-12 21:42 ` brian m. carlson
2022-10-13 2:17 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq35bsk9og.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=ignacio.taranto@eclypsium.com \
--cc=sandals@crustytoothpaste.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).