From: David Symonds Date: Wed, 29 Oct 2008 16:15:36 +0000 (-0700) Subject: git-diff: Add --staged as a synonym for --cached. X-Git-Tag: v1.6.1-rc1~68 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2baf1850ceb01dfbee862e30f2a69cf6064e13eb;p=git.git git-diff: Add --staged as a synonym for --cached. Signed-off-by: Junio C Hamano --- diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt index c53eba557..a2f192fb7 100644 --- a/Documentation/git-diff.txt +++ b/Documentation/git-diff.txt @@ -33,6 +33,7 @@ forced by --no-index. commit relative to the named . Typically you would want comparison with the latest commit, so if you do not give , it defaults to HEAD. + --staged is a synonym of --cached. 'git diff' [--options] [--] [...]:: diff --git a/builtin-diff.c b/builtin-diff.c index 9c8c29573..82d4ddabd 100644 --- a/builtin-diff.c +++ b/builtin-diff.c @@ -118,7 +118,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, "--cached") || !strcmp(arg, "--staged")) cached = 1; else usage(builtin_diff_usage); @@ -319,7 +319,8 @@ int cmd_diff(int argc, const char **argv, const char *prefix) const char *arg = argv[i]; if (!strcmp(arg, "--")) break; - else if (!strcmp(arg, "--cached")) { + else if (!strcmp(arg, "--cached") || + !strcmp(arg, "--staged")) { add_head_to_pending(&rev); if (!rev.pending.nr) die("No HEAD commit to compare with (yet)");