Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff --cached: give more sensible error message when HEAD is yet to be created.
author
Junio C Hamano
<junkio@cox.net>
Sun, 25 Feb 2007 06:26:33 +0000
(22:26 -0800)
committer
Junio C Hamano
<junkio@cox.net>
Sun, 25 Feb 2007 19:09:56 +0000
(11:09 -0800)
It is not like the user said 'diff --cached HEAD', so complaining about
HEAD not being a valid commit, while technically might be correct, is
not very helpful.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-diff.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
56cf980
)
diff --git
a/builtin-diff.c
b/builtin-diff.c
index c387ebb16c6bd353a84abd9454892eeab309ef1e..67f49329bf6bad1a5bf2592b1792b65421278708 100644
(file)
--- a/
builtin-diff.c
+++ b/
builtin-diff.c
@@
-261,6
+261,8
@@
int cmd_diff(int argc, const char **argv, const char *prefix)
break;
else if (!strcmp(arg, "--cached")) {
add_head(&rev);
+ if (!rev.pending.nr)
+ die("No HEAD commit to compare with (yet)");
break;
}
}