Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-25 09:26:33 +0300
committerJunio C Hamano <junkio@cox.net>2007-02-25 22:09:56 +0300
commit6c09c451389ade6477d98b05d277aab0dd2f272e (patch)
tree1921a2e641de643a7bd791c379f242311c5d9e35 /builtin-diff.c
parent56cf9806a97f5fe9a91c38aa3eb8cec0c76480e6 (diff)
diff --cached: give more sensible error message when HEAD is yet to be created.
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>
Diffstat (limited to 'builtin-diff.c')
-rw-r--r--builtin-diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-diff.c b/builtin-diff.c
index c387ebb16c..67f49329bf 100644
--- 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;
}
}