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

Merge diff always misses the `\ No newline at end of file` mark

From
Danil Pristupov <danil@danil.cz>
Date
Apr 30, 2022, 15:05 UTC
Message-ID
<CAKdzDnk4FFPedTQ4fG1c-BZ4ST99E1ucx664r_oc-5123P6ovA@mail.gmail.com>

For files with conflicts `git diff -- filename` always returns result without the `No newline at end of file` mark.

I was able to reproduce this with all git versions on all platforms.
Steps to reproduce (macOS, 2.32.0 (Apple Git-132)):

``` git init echo "line1\nline2" > eol.txt echo -n "line1\nline2" > noeol.txt git add . git commit -m "initial" git branch br1 echo "line11\nline2" > eol.txt echo -n "line11\nline2" > noeol.txt git add . git commit -m "line1" git checkout br1 echo "line12\nline2" > eol.txt echo -n "line12\nline2" > noeol.txt git add . git commit -m "line2" git merge master git diff -- eol.txt > eol.diff git diff -- noeol.txt > noeol.diff ```

Expected behavior: `noeol.diff` should have `\ No newline at end of file` mark

Actual behavior: Both `eol.diff` and `noeol.diff` have no `\ No newline at end of file` mark

This is my first bug report. Please let me know if I'm missing something.
Message 1 of 1 in “Merge diff always misses the `\ No newline at end of file` mark”
  1. Danil PristupovApr 30, 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.