summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-09-19 01:12:18 -0700
committerJunio C Hamano <junkio@cox.net>2005-09-19 19:20:26 -0700
commit0a2ba73860211efec479396c33ba381056715be5 (patch)
tree4633b3a50abee001a1373517308fa6d1242d0749
parent1f961c196cbb475e612a4fb082b33efde71e7a03 (diff)
downloadgit-0a2ba73860211efec479396c33ba381056715be5.tar.gz
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)
-rw-r--r--show-branch.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/show-branch.c b/show-branch.c
index 262acf5cef..8cc0755e0a 100644
--- a/show-branch.c
+++ b/show-branch.c
@@ -196,8 +196,11 @@ static void show_one_commit(struct commit *commit)
{
char pretty[128], *cp;
struct commit_name *name = commit->object.util;
- pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
- pretty, sizeof(pretty));
+ if (commit->object.parsed)
+ pretty_print_commit(CMIT_FMT_ONELINE, commit->buffer, ~0,
+ pretty, sizeof(pretty));
+ else
+ strcpy(pretty, "(unavailable)");
if (!strncmp(pretty, "[PATCH] ", 8))
cp = pretty + 8;
else