I became aware of this because a pre-commit config started checking for the trailing-whitespace condition (the generated diff in question is itself part of a repo so a git commit
catches the condition of the whitespaces).
I basically refer to all the empty lines in a default git diff
output which are not part of patching itself; e.g. all the empty lines before a diff --git a ...
line; they always contain 1 whitespace between the 2 newlines.
I believe they are produced when it shows the surrounding relevant code which is not part of patching, for readability, but those lines in the files compared themselves do not have whitespaces!
e.g. after changing a file with contents:
hello = "Hellow Stack Overflow"
print(hello)
quit()
git diff
output:
diff --git a/1.py b/1.py
index da132e0..4fdf846 100644
--- a/1.py
+++ b/1.py
@@ -1,4 +1,4 @@
-hello = "Hellow Stack Overflow"
+hello = "Hello Stack Overflow"
print(hello)
(the line before print(hello)
and the line after print(hello)
in the patch have a whitespace each (and removing the whitespaces: the patch still works))