From ded9393b173853d2e960f9b176aeb0bc4ed35be2 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Fri, 11 May 2007 12:12:48 +0200 Subject: Add submodule links in tree listing When a submodule occurs in a tree, generate a link to show the module/commit. The link is specified as a sprintf string in /etc/cgitrc, using parameters 'module-link' and 'repo.module-link'. This should probably be extended with repo.module-link.$path. Signed-off-by: Lars Hjemli --- ui-tree.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'ui-tree.c') diff --git a/ui-tree.c b/ui-tree.c index 60f7560..dee8309 100644 --- a/ui-tree.c +++ b/ui-tree.c @@ -15,11 +15,11 @@ static int print_entry(const unsigned char *sha1, const char *base, { char *name; enum object_type type; - unsigned long size; + unsigned long size = 0; name = xstrdup(pathname); type = sha1_object_info(sha1, &size); - if (type == OBJ_BAD) { + if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { htmlf("Bad object: %s %s", name, sha1_to_hex(sha1)); @@ -27,26 +27,27 @@ static int print_entry(const unsigned char *sha1, const char *base, } html(""); html_filemode(mode); - html(""); + html("%s => submodule", name); + htmlf("class='ls-mod'>%s", name); } else { - html("
%s
", name); } - html(""); + htmlf("'>%s", name); htmlf("%li", size); html("\n"); free(name); -- cgit v1.2.3-70-g09d2