Re: Why doesn't git-apply remove empty file
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 13, 2008, 00:25 UTC
- Message-ID
- <7vod3xpxq2.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <38b2ab8a0808120917h10f15c81v4d1f04c0174dc994@mail.gmail.com>
If you want to create an empty file, the patch would look like this:
diff --git a/bar b/bar
index 257cc56..e69de29 100644
--- a/bar
+++ b/bar
@@ -1 +0,0 @@
-fooOn the other hand, if you want to remove an empty file, the patch would look like this:
diff --git a/bar b/bar
deleted file mode 100644
index 257cc56..0000000
--- a/bar
+++ /dev/null
@@ -1 +0,0 @@
-fooA patch generated by non-git tools would lack "index" and "deleted" lines, but they will still have difference between "bar" and "/dev/null" on the postimage filename (i.e. "+++" line), and git-apply leaves an empty file for the former, and removes the file for the latter patch.