git-diff: Introduce --index and deprecate --cached.
'git diff --cached' still works, but its use is discouraged in the documentation. 'git diff --index' does the same thing and is consistent with how 'git apply --index' works. Signed-off-by: Andreas Ericsson <ae@op5.se> Signed-off-by: Junio C Hamano <junkio@cox.net>
Andreas Ericsson committed
Nov 30, 2006 at 12:43 UTC
4c81c213a479e4aae0653a56ad6e8db5c31f019c
2 files changed
+5
-3
Documentation/git-diff.txt
+4
-2
@@ -22,8 +22,10 @@ the number of trees given to the command.
22
23
* When one <tree-ish> is given, the working tree and the named
24
tree are compared, using `git-diff-index`. The option
25
- `--cached` can be given to compare the index file and
25
+ `--index` can be given to compare the index file and
26
the named tree.
27
+ `--cached` is a deprecated alias for `--index`. It's use is
28
+ discouraged.
29
30
* When two <tree-ish>s are given, these two trees are compared
31
using `git-diff-tree`.
@@ -47,7 +49,7 @@ Various ways to check your working tree::
49
+
50
------------
51
$ git diff <1>
50
-$ git diff --cached <2>
52
+$ git diff --index <2>
53
$ git diff HEAD <3>
54
------------
55
+
builtin-diff.c
+1
-1
@@ -137,7 +137,7 @@ static int builtin_diff_index(struct rev_info *revs,
137
int cached = 0;
138
while (1 < argc) {
139
const char *arg = argv[1];
140
- if (!strcmp(arg, "--cached"))
140
+ if (!strcmp(arg, "--index") || !strcmp(arg, "--cached"))
141
cached = 1;
142
else
143
usage(builtin_diff_usage);