This question already has an answer here:
After executing these 4 commands, directory "a" has file "1" with contents "test" and file "2" which is empty, and directory "b" is empty.
$ mkdir a $ mkdir b $ echo test > a/1 $ touch a/2
We can run
$ diff -r a b Only in a: 1 Only in a: 2
Which isn't helpful for a patch. Or, we can run
$ diff -rN a b diff -rN a/1 b/1 1d0 < test
Which is great for file "1" because we see its contents, but now file "2" has disappeared. This is because the
-N flag means "treat absent files as empty", so I presume diff can't see the difference between the empty file "a/2" and the (pretend, since really empty) empty file "b/2".
Is there a way to make diff show us, in one execution, that a new empty file has been created, and the contents of a new non-empty file -- in a format that patch can use?
Or, would this require a new option to diff?