1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-10 15:46:11 +02:00

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>
This commit is contained in:
Junio C Hamano 2007-02-24 22:26:33 -08:00
parent 56cf9806a9
commit 6c09c45138

View File

@ -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;
}
}