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
Родитель 56cf9806a9
Коммит 6c09c45138
1 изменённых файлов: 2 добавлений и 0 удалений

Просмотреть файл

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