projects
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
56cf980
)
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
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;
}
}