From cbcdbcf2bff23113fe81df8f11fe7843b8ed637e Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sun, 28 Oct 2007 15:36:18 +0100 Subject: Make print_branch() handle refs not pointing at commits The master branch of stable/linux-2.6.20 currently references a tag object, which makes print_branch() die with a segfault. This teaches print_branch() to handle such cases more gracefully. Signed-off-by: Lars Hjemli --- ui-summary.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'ui-summary.c') diff --git a/ui-summary.c b/ui-summary.c index 04a466a..ba90510 100644 --- a/ui-summary.c +++ b/ui-summary.c @@ -58,11 +58,17 @@ static int print_branch(struct refinfo *ref) html(""); cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0); html(""); - cgit_print_age(info->commit->date, -1, NULL); - html(""); - html_txt(info->author); - html(""); - cgit_commit_link(info->subject, NULL, NULL, name, NULL); + + if (ref->object->type == OBJ_COMMIT) { + cgit_print_age(info->commit->date, -1, NULL); + html(""); + html_txt(info->author); + html(""); + cgit_commit_link(info->subject, NULL, NULL, name, NULL); + } else { + html(""); + cgit_object_link(ref->object); + } html("\n"); return 0; } -- cgit v1.2.3-24-g4f1b