show-branch: Be nicer when running in a corrupt repository.
We may end up trying to print a commit we do not actually have but we know about its existence only because another commit we do have refers to it. Signed-off-by: Junio C Hamano <junkio@cox.net> (cherry picked from b204feab9371040982d2c60611925e7693106c84 commit)maint
parent
1f961c196c
commit
0a2ba73860
|
@ -196,8 +196,11 @@ static void show_one_commit(struct commit *commit)
|
||||||
{
|
{
|
||||||
char pretty[128], *cp;
|
char pretty[128], *cp;
|
||||||
struct commit_name *name = commit->object.util;
|
struct commit_name *name = commit->object.util;
|
||||||
pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
|
if (commit->object.parsed)
|
||||||
pretty, sizeof(pretty));
|
pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
|
||||||
|
pretty, sizeof(pretty));
|
||||||
|
else
|
||||||
|
strcpy(pretty, "(unavailable)");
|
||||||
if (!strncmp(pretty, "[PATCH] ", 8))
|
if (!strncmp(pretty, "[PATCH] ", 8))
|
||||||
cp = pretty + 8;
|
cp = pretty + 8;
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue