That was very well explained, thank you. The problem seems to be that some people interpret this message as a real warning since it's often a good practice to always end text files with a newline (at least on *nix systems). Of course this doesn't apply to symlinks at all. On Wed, Oct 12, 2022 at 6:31 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Ignacio Taranto <ignacio.taranto@xxxxxxxxxxxxx> writes: > > > 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? > > Yes, but not really. > > It is not "warning" at all. The users want to know when compared > contents do or do not end with an incomplete line at the end, and > the "\ No newline" is the diff's way to give that single bit of > information to us. > > And the contents of a symbolic link typically is a single incomplete > line, so it is expected to see "\ No newline" when comparing them. > > This is important as "git diff | git -C ../some/where/else apply" > should be able to recreate the change in the current repository > (which may have change to or addition of a symbolic link) in the > other repository, and "git apply" on the receiving end must be able > to tell that the symbolic link it needs to create in the other > repository must not have an extra LF at the end. >