-rw-r--r-- | cgit.css | 2 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | cgitrc | 5 | ||||
-rw-r--r-- | html.c | 3 | ||||
-rw-r--r-- | shared.c | 6 | ||||
-rw-r--r-- | ui-tree.c | 19 |
6 files changed, 26 insertions, 11 deletions
@@ -143,3 +143,3 @@ div.error { -div.ls-blob, div.ls-dir { +td.ls-blob, td.ls-dir, td.ls-mod { font-family: monospace; @@ -35,2 +35,3 @@ struct repoinfo { char *owner; + char *module_link; int snapshots; @@ -72,2 +73,3 @@ extern char *cgit_logo; extern char *cgit_logo_link; +extern char *cgit_module_link; extern char *cgit_virtual_root; @@ -49,2 +49,6 @@ +## Url loaded when clicking a submodule link +#module-link=./?repo=%s&page=commit&id=%s + + ## Number of chars shown of commit subject message (in log view) @@ -84 +88,2 @@ #repo.snapshots=1 # override a sitewide snapshot-setting +#repo.module-link=/git/%s/commit/?id=%s # override the standard module-link @@ -160,2 +160,4 @@ void html_filemode(unsigned short mode) html("l"); + else if (S_ISDIRLNK(mode)) + html("m"); else @@ -166,2 +168 @@ void html_filemode(unsigned short mode) } - @@ -17,2 +17,3 @@ char *cgit_logo = "/git-logo.png"; char *cgit_logo_link = "http://www.kernel.org/pub/software/scm/git/docs/"; +char *cgit_module_link = "./?repo=%s&page=commit&id=%s"; char *cgit_virtual_root = NULL; @@ -87,2 +88,3 @@ struct repoinfo *add_repo(const char *url) ret->snapshots = cgit_snapshots; + ret->module_link = cgit_module_link; return ret; @@ -100,2 +102,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_logo_link = xstrdup(value); + else if (!strcmp(name, "module-link")) + cgit_module_link = xstrdup(value); else if (!strcmp(name, "virtual-root")) @@ -130,2 +134,4 @@ void cgit_global_config_cb(const char *name, const char *value) cgit_repo->snapshots = atoi(value); + else if (cgit_repo && !strcmp(name, "repo.module-link")) + cgit_repo->module_link= xstrdup(value); } @@ -17,3 +17,3 @@ static int print_entry(const unsigned char *sha1, const char *base, enum object_type type; - unsigned long size; + unsigned long size = 0; @@ -21,3 +21,3 @@ static int print_entry(const unsigned char *sha1, const char *base, type = sha1_object_info(sha1, &size); - if (type == OBJ_BAD) { + if (type == OBJ_BAD && !S_ISDIRLNK(mode)) { htmlf("<tr><td colspan='3'>Bad object: %s %s</td></tr>", @@ -29,7 +29,10 @@ static int print_entry(const unsigned char *sha1, const char *base, html_filemode(mode); - html("</td><td>"); + html("</td><td "); if (S_ISDIRLNK(mode)) { - htmlf("<div class='ls-dirlnk'>%s => submodule</div>", name); + htmlf("class='ls-mod'><a href='"); + html_attr(fmt(cgit_repo->module_link, + name, + sha1_to_hex(sha1))); } else if (S_ISDIR(mode)) { - html("<div class='ls-dir'><a href='"); + html("class='ls-dir'><a href='"); html_attr(cgit_pageurl(cgit_query_repo, "tree", @@ -39,5 +42,4 @@ static int print_entry(const unsigned char *sha1, const char *base, pathname))); - htmlf("'>%s</a></div>", name); } else { - html("<div class='ls-blob'><a href='"); + html("class='ls-blob'><a href='"); html_attr(cgit_pageurl(cgit_query_repo, "view", @@ -46,5 +48,4 @@ static int print_entry(const unsigned char *sha1, const char *base, pathname))); - htmlf("'>%s</a></div>", name); } - html("</div></td>"); + htmlf("'>%s</a></div></td>", name); htmlf("<td class='filesize'>%li</td>", size); |