git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-diff: Add --staged as a synonym for --cached.
@ 2008-10-29 16:15 David Symonds
  2008-10-29 16:42 ` Jeff King
  0 siblings, 1 reply; 29+ messages in thread
From: David Symonds @ 2008-10-29 16:15 UTC (permalink / raw)
  To: git, gitster, Jeff King, Johannes Schindelin, Stephan Beyer; +Cc: David Symonds

---
 Consider this as a replacement to the previous git-staged series.

 Documentation/git-diff.txt |    1 +
 builtin-diff.c             |    5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt
index c53eba5..a2f192f 100644
--- a/Documentation/git-diff.txt
+++ b/Documentation/git-diff.txt
@@ -33,6 +33,7 @@ forced by --no-index.
 	commit relative to the named <commit>.  Typically you
 	would want comparison with the latest commit, so if you
 	do not give <commit>, it defaults to HEAD.
+	--staged is a synonym of --cached.
 
 'git diff' [--options] <commit> [--] [<path>...]::
 
diff --git a/builtin-diff.c b/builtin-diff.c
index 2de5834..7ceceeb 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);
@@ -320,7 +320,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)");
-- 
1.6.0

^ permalink raw reply related	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2008-11-12 23:44 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-29 16:15 [PATCH] git-diff: Add --staged as a synonym for --cached David Symonds
2008-10-29 16:42 ` Jeff King
2008-10-29 16:50   ` David Symonds
2008-10-29 17:06     ` Johannes Schindelin
2008-10-29 17:11       ` Jeff King
2008-11-02  8:30         ` Junio C Hamano
2008-11-03  7:04           ` Jeff King
2008-11-02 12:35         ` Björn Steinbrink
2008-11-02 18:30           ` Junio C Hamano
2008-11-02 18:54             ` Björn Steinbrink
2008-11-03  7:14             ` Jeff King
2008-11-10 23:37               ` David Symonds
2008-11-11  0:15                 ` Jeff King
2008-11-11  1:11                 ` Junio C Hamano
2008-11-11  1:22                   ` Jeff King
2008-11-12  0:57                     ` Junio C Hamano
2008-11-11  4:04               ` Avery Pennarun
2008-11-11  5:49                 ` Miles Bader
2008-11-12  8:33                 ` Jeff King
2008-11-12 11:10                   ` Johannes Schindelin
2008-11-12 11:06                     ` Jeff King
2008-11-12 15:39                       ` Avery Pennarun
2008-11-12 19:15                         ` Jeff King
2008-11-12 19:29                           ` Junio C Hamano
2008-11-12 19:37                             ` Jeff King
2008-11-12 19:57                               ` Junio C Hamano
2008-11-12 22:39                                 ` Avery Pennarun
2008-11-12 23:42                                   ` Junio C Hamano
2008-11-12 15:46                     ` Avery Pennarun

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 NNTP newsgroup(s).