-rw-r--r-- | cgit.css | 2 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | cgitrc | 7 | ||||
-rw-r--r-- | html.c | 3 | ||||
-rw-r--r-- | shared.c | 6 | ||||
-rw-r--r-- | ui-tree.c | 19 |
6 files changed, 27 insertions, 12 deletions
@@ -142,5 +142,5 @@ div.error { } -div.ls-blob, div.ls-dir { +td.ls-blob, td.ls-dir, td.ls-mod { font-family: monospace; } @@ -34,4 +34,5 @@ struct repoinfo { char *desc; char *owner; + char *module_link; int snapshots; }; @@ -71,4 +72,5 @@ extern char *cgit_css; extern char *cgit_logo; extern char *cgit_logo_link; +extern char *cgit_module_link; extern char *cgit_virtual_root; extern char *cgit_cache_root; @@ -48,4 +48,8 @@ +## 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) #max-message-length=60 @@ -82,3 +86,4 @@ #repo.path=/pub/git/cgit #repo.owner=Lars Hjemli -#repo.snapshots=1 # override a sitewide snapshot-setting +#repo.snapshots=1 # override a sitewide snapshot-setting +#repo.module-link=/git/%s/commit/?id=%s # override the standard module-link @@ -159,4 +159,6 @@ void html_filemode(unsigned short mode) else if (S_ISLNK(mode)) html("l"); + else if (S_ISDIRLNK(mode)) + html("m"); else html("-"); @@ -165,3 +167,2 @@ void html_filemode(unsigned short mode) html_fileperm(mode); } - @@ -16,4 +16,5 @@ char *cgit_css = "/cgit.css"; 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; @@ -86,4 +87,5 @@ struct repoinfo *add_repo(const char *url) ret->owner = NULL; ret->snapshots = cgit_snapshots; + ret->module_link = cgit_module_link; return ret; } @@ -99,4 +101,6 @@ void cgit_global_config_cb(const char *name, const char *value) else if (!strcmp(name, "logo-link")) cgit_logo_link = xstrdup(value); + else if (!strcmp(name, "module-link")) + cgit_module_link = xstrdup(value); else if (!strcmp(name, "virtual-root")) cgit_virtual_root = xstrdup(value); @@ -129,4 +133,6 @@ void cgit_global_config_cb(const char *name, const char *value) else if (cgit_repo && !strcmp(name, "repo.snapshots")) cgit_repo->snapshots = atoi(value); + else if (cgit_repo && !strcmp(name, "repo.module-link")) + cgit_repo->module_link= xstrdup(value); } @@ -16,9 +16,9 @@ static int print_entry(const unsigned char *sha1, const char *base, char *name; enum object_type type; - unsigned long size; + unsigned long size = 0; name = xstrdup(pathname); 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>", name, @@ -28,9 +28,12 @@ static int print_entry(const unsigned char *sha1, const char *base, html("<tr><td class='filemode'>"); 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", fmt("id=%s&path=%s%s/", @@ -38,14 +41,12 @@ static int print_entry(const unsigned char *sha1, const char *base, cgit_query_path ? cgit_query_path : "", 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", fmt("id=%s&path=%s%s", sha1_to_hex(sha1), cgit_query_path ? cgit_query_path : "", pathname))); - htmlf("'>%s</a></div>", name); } - html("</div></td>"); + htmlf("'>%s</a></div></td>", name); htmlf("<td class='filesize'>%li</td>", size); html("</tr>\n"); |