-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diff: support --cached on unborn branches
"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>
- Loading branch information
Nguyễn Thái Ngọc Duy
authored and
Junio C Hamano
committed
Feb 7, 2011
1 parent
2e9c878
commit a2b7a3b
Showing
5 changed files
with
71 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
diff --git a/dir/sub b/dir/sub | ||
new file mode 100644 | ||
index 0000000..992913c | ||
--- /dev/null | ||
+++ b/dir/sub | ||
@@ -0,0 +1,8 @@ | ||
+A | ||
+B | ||
+C | ||
+D | ||
+E | ||
+F | ||
+1 | ||
+2 | ||
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 | ||
diff --git a/file1 b/file1 | ||
new file mode 100644 | ||
index 0000000..b1e6722 | ||
--- /dev/null | ||
+++ b/file1 | ||
@@ -0,0 +1,3 @@ | ||
+A | ||
+B | ||
+C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
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 |