about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLars Hjemli <hjemli@gmail.com>2011-06-15 10:10:41 +0200
committerLars Hjemli <hjemli@gmail.com>2011-06-15 10:40:13 +0200
commit7421857b4da9b8523032f08824bca9f3e3ebec4e (patch)
treedde9cdb37203cc3c9466017f3c2ac8fc803bf5e9
parentui-tree.c: add support for path-selected submodule links (diff)
downloadcgit-pink-7421857b4da9b8523032f08824bca9f3e3ebec4e.tar.gz
cgit-pink-7421857b4da9b8523032f08824bca9f3e3ebec4e.zip
ui-plain.c: add support for path-selected submodule links
In ui-plain.c, the links generated for submodule entry ignored the fact
that the entry was in fact a submodule. This patch adds proper submodule
links to the plain directory listings.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r--ui-plain.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui-plain.c b/ui-plain.c
index 733db4d..2abd210 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -97,11 +97,14 @@ static void print_dir_entry(const unsigned char *sha1, const char *base,
 	char *fullpath;
 
 	fullpath = buildpath(base, baselen, path);
-	if (!S_ISDIR(mode))
+	if (!S_ISDIR(mode) && !S_ISGITLINK(mode))
 		fullpath[strlen(fullpath) - 1] = 0;
 	html("  <li>");
-	cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.sha1,
-			fullpath);
+	if (S_ISGITLINK(mode)) {
+		cgit_submodule_link(NULL, fullpath, sha1_to_hex(sha1));
+	} else
+		cgit_plain_link(path, NULL, NULL, ctx.qry.head, ctx.qry.sha1,
+				fullpath);
 	html("</li>\n");
 	match = 2;
 }
mp;follow=1'>Respect mailmap in gl pretty formatJune McEnroe 2019-12-20Set LANG in cgit filtersJune McEnroe ttpre needs to know about UTF-8 too so it can bold/italic non-ASCII chars. 2019-12-20Source .editrc before applying -v or -eJune McEnroe Otherwise a bind -v in .editrc will take precedence and overwrite the ^I binding for sh-complete. 2019-12-20Disable signing commitsJune McEnroe Why did I ever turn this on? This gets me nothing but inconvenience. RIP to all the wasted bytes in my git repos. 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe Hack: output an extra <td> after rendering mdoc so that line numbers can be hidden based on there being three. This required splitting source-filter and about-filter since on about pages there is no table. 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe :target persists after you click on something else. 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe NULs in the input cause an infinite loop in htmlEscape, not to mention regexes obviously not working, etc. 2019-12-16Post "cgit setup"June McEnroe