diff options
Diffstat (limited to 'source/ui-tree.c')
| -rw-r--r-- | source/ui-tree.c | 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 file changed, 14 insertions, 10 deletions
diff --git a/source/ui-tree.c b/source/ui-tree.c index 58bd7f0..c030134 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -329,19 +329,23 @@ static void print_ls_row(const struct object_id *oid, const char *pathname, if (S_ISLNK(mode) && size <= PATH_MAX) { html(" -> "); buf = odb_read_object(the_repository->objects, oid, &type, &size); + // An unreadable target stands in for the link, and the rest of + // the row still goes out so the table stays whole. if (!buf) { htmlf("Unable to read object %s", oid_to_hex(oid)); - goto cleanup; + } else { + strbuf_addbuf(&linkpath, &fullpath); + strbuf_addf(&linkpath, "/../%s", buf); + // A target climbing above the tree root has nothing to + // link to. + if (strbuf_normalize_path(&linkpath)) + html_txt(buf); + else + cgit_tree_link(buf, NULL, class.buf, ctx.qry.head, walk->rev, + linkpath.buf); + free(buf); + strbuf_release(&linkpath); } - strbuf_addbuf(&linkpath, &fullpath); - strbuf_addf(&linkpath, "/../%s", buf); - // A target climbing above the tree root has nothing to link to. - if (strbuf_normalize_path(&linkpath)) - html_txt(buf); - else - cgit_tree_link(buf, NULL, class.buf, ctx.qry.head, walk->rev, linkpath.buf); - free(buf); - strbuf_release(&linkpath); } if (S_ISGITLINK(mode)) html("</td><td class='ls-size'>-</td>"); |
