From: Andreas Ericsson <ae@op5.se>
To: git@vger.kernel.org
Subject: [PATCH] git-diff: Introduce --index and deprecate --cached.
Date: Thu, 30 Nov 2006 12:43:13 +0100 [thread overview]
Message-ID: <20061130115913.EA36C5BA19@nox.op5.se> (raw)
'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>
---
Documentation/git-diff.txt | 6 ++++--
builtin-diff.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index 228c4d9..3144864 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -22,8 +22,10 @@ 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
- `--cached` can be given to compare the index file and
+ `--index` 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`.
@@ -47,7 +49,7 @@ Various ways to check your working tree::
+
------------
$ git diff <1>
-$ git diff --cached <2>
+$ git diff --index <2>
$ git diff HEAD <3>
------------
+
diff --git a/builtin-diff.c b/builtin-diff.c
index a659020..1c535b1 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -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, "--cached"))
+ if (!strcmp(arg, "--index") || !strcmp(arg, "--cached"))
cached = 1;
else
usage(builtin_diff_usage);
--
1.4.4.1.GIT
next reply other threads:[~2006-11-30 11:59 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-30 11:43 Andreas Ericsson [this message]
2006-12-09 2:24 ` [PATCH] git-diff: Introduce --index and deprecate --cached Junio C Hamano
2006-12-09 2:29 ` Junio C Hamano
-- strict thread matches above, loose matches on Subject: below --
2020-11-10 7:32 Jake Steward
2021-09-12 21:39 nu ja
2022-06-15 7:58 Ali Almrhbi
2022-12-17 21:48 Bob Swift
2023-10-10 3:46 Russell Nelson
2024-05-05 20:06 hosamtot
2024-05-06 10:27 Toshihide Mitumaru
2024-09-03 20:55 Cathy Litton
2024-09-29 3:29 Crystal M Baker
2024-11-30 8:41 saul cleto
2025-01-19 5:56 Andrew Farrow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061130115913.EA36C5BA19@nox.op5.se \
--to=ae@op5.se \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).