The message cited in your question indicates the newline was added in the newer version of the file being diffed.
If instead the newline had been removed in the newer version of the file being diffed, you’d see this:
diff --git a/file.txt b/file.txt
index abcdef..ghijkl mnopqr
--- a/file.txt
+++ b/file.txt
@@ -2,4 +2,4 @@
-This is a line of code.
+This is a line of code.
\ No newline at end of file
That is, the \ No newline at end of file
part would be the very last line of the diff.
If you want to test this yourself, here are two files you can run diff -u
on:
- noeol.txt (which has no newline at the end of file)
- eol.txt (which has a newline at the end of file)
diff -u noeol.txt eol.txt
will give you this:
--- noeol.txt 2016-08-13 12:55:16.000000000 +0900
+++ eol.txt 2016-08-13 12:55:23.000000000 +0900
@@ -1 +1 @@
-This is a line of code.
\ No newline at end of file
+This is a line of code.
diff -u eol.txt noeol.txt
will give you this:
--- eol.txt 2016-08-13 12:55:23.000000000 +0900
+++ noeol.txt 2016-08-13 12:55:16.000000000 +0900
@@ -1 +1 @@
-This is a line of code.
+This is a line of code.
\ No newline at end of file