From 717c9a822db8e081c2001b79d63eaa1663277b95 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 17 Oct 2026 12:53:18 -1000 Subject: Show an absolute link target as text A symlink to /etc/passwd was resolved against the tree and linked to etc/passwd inside it, a different file or none at all. --- source/ui-tree.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/ui-tree.c') diff --git a/source/ui-tree.c b/source/ui-tree.c index c030134..51ab9ff 100644 --- a/source/ui-tree.c +++ b/source/ui-tree.c @@ -336,9 +336,10 @@ static void print_ls_row(const struct object_id *oid, const char *pathname, } 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)) + // A target climbing above the tree root, or one given + // from the root of the filesystem, has nothing in the + // tree to link to. + if (buf[0] == '/' || strbuf_normalize_path(&linkpath)) html_txt(buf); else cgit_tree_link(buf, NULL, class.buf, ctx.qry.head, walk->rev, -- cgit