Skip to content

Commit

Permalink
Revert "git-diff: Introduce --index and deprecate --cached."
Browse files Browse the repository at this point in the history
This reverts commit 4c81c21.

Although --cached and --index are confusing wording, the use of
word --cached for git-diff is consistent with git-apply.  It means
"work with index without looking at the working tree".

We should probably come up with better wording for --cached, if
somebody wants to deprecate it.  But making --index and --cached
synonyms for diff while leaving them mean different things for
apply is no good.
  • Loading branch information
Junio C Hamano committed Dec 13, 2006
1 parent 1349f87 commit f2dd1c9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions Documentation/git-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ the number of trees given to the command.

* When one <tree-ish> is given, the working tree and the named
tree are compared, using `git-diff-index`. The option
`--index` can be given to compare the index file and
`--cached` can be given to compare the index file and
the named tree.
`--cached` is a deprecated alias for `--index`. It's use is
discouraged.

* When two <tree-ish>s are given, these two trees are compared
using `git-diff-tree`.
Expand All @@ -49,7 +47,7 @@ Various ways to check your working tree::
+
------------
$ git diff <1>
$ git diff --index <2>
$ git diff --cached <2>
$ git diff HEAD <3>
------------
+
Expand Down
2 changes: 1 addition & 1 deletion builtin-diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static int builtin_diff_index(struct rev_info *revs,
int cached = 0;
while (1 < argc) {
const char *arg = argv[1];
if (!strcmp(arg, "--index") || !strcmp(arg, "--cached"))
if (!strcmp(arg, "--cached"))
cached = 1;
else
usage(builtin_diff_usage);
Expand Down

0 comments on commit f2dd1c9

Please sign in to comment.