aboutsummaryrefslogtreecommitdiffstats
path: root/ui-tree.c
diff options
context:
space:
mode:
authorLars Hjemli2011-06-15 10:04:13 +0200
committerLars Hjemli2011-06-15 10:40:13 +0200
commit6857bec50a52340fa6b85d626f49d45dd331ed0e (patch)
treef746931d5173cab78d32ead3196186c97c5fd9b7 /ui-tree.c
parent8729d251a900b2e6e22cc4c93a2193fd8a2b9acf (diff)
downloadcgit-6857bec50a52340fa6b85d626f49d45dd331ed0e.tar.gz
cgit-6857bec50a52340fa6b85d626f49d45dd331ed0e.tar.bz2
cgit-6857bec50a52340fa6b85d626f49d45dd331ed0e.zip
ui-tree.c: add support for path-selected submodule links
The current 'repo.module-link' option is sufficient when all gitlinks in a repository can be converted to commit links in a uniform way, but not when different submodules/paths needs different settings. This patch adds support for 'repo.module-link.<path>', which will be used for linking to submodules at paths matching one such entry. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/ui-tree.c b/ui-tree.c
index 442b6be..b1adcc7 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -150,13 +150,7 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
150 cgit_print_filemode(mode); 150 cgit_print_filemode(mode);
151 html("</td><td>"); 151 html("</td><td>");
152 if (S_ISGITLINK(mode)) { 152 if (S_ISGITLINK(mode)) {
153 htmlf("<a class='ls-mod' href='"); 153 cgit_submodule_link("ls-mod", fullpath, sha1_to_hex(sha1));
154 html_attr(fmt(ctx.repo->module_link,
155 name,
156 sha1_to_hex(sha1)));
157 html("'>");
158 html_txt(name);
159 html("</a>");
160 } else if (S_ISDIR(mode)) { 154 } else if (S_ISDIR(mode)) {
161 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, 155 cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head,
162 curr_rev, fullpath); 156 curr_rev, fullpath);
@@ -177,8 +171,9 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
177 if (ctx.repo->max_stats) 171 if (ctx.repo->max_stats)
178 cgit_stats_link("stats", NULL, "button", ctx.qry.head, 172 cgit_stats_link("stats", NULL, "button", ctx.qry.head,
179 fullpath); 173 fullpath);
180 cgit_plain_link("plain", NULL, "button", ctx.qry.head, curr_rev, 174 if (!S_ISGITLINK(mode))
181 fullpath); 175 cgit_plain_link("plain", NULL, "button", ctx.qry.head, curr_rev,
176 fullpath);
182 html("</td></tr>\n"); 177 html("</td></tr>\n");
183 free(name); 178 free(name);
184 return 0; 179 return 0;