mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
![Nguyễn Thái Ngọc Duy](/assets/img/avatar_default.png)
"git diff --cached" (without revision) used to mean "git diff --cached HEAD" (i.e. the user was too lazy to type HEAD). This "correctly" failed when there was no commit yet. But was that correctness useful? This patch changes the definition of what particular command means. It is a request to show what _would_ be committed without further "git add". The internal implementation is the same "git diff --cached HEAD" when HEAD exists, but when there is no commit yet, it compares the index with an empty tree object to achieve the desired result. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
16 lines
140 B
Plaintext
16 lines
140 B
Plaintext
diff --git a/file0 b/file0
|
|
new file mode 100644
|
|
index 0000000..10a8a9f
|
|
--- /dev/null
|
|
+++ b/file0
|
|
@@ -0,0 +1,9 @@
|
|
+1
|
|
+2
|
|
+3
|
|
+4
|
|
+5
|
|
+6
|
|
+A
|
|
+B
|
|
+C
|