-rw-r--r-- | cgit.c | 2 | ||||
-rw-r--r-- | cgit.h | 2 | ||||
-rw-r--r-- | ui-view.c | 11 |
3 files changed, 10 insertions, 5 deletions
@@ -108,9 +108,9 @@ static void cgit_print_repo_page(struct cacheitem *item) cgit_print_tree(cgit_query_sha1, cgit_query_path); } else if (!strcmp(cgit_query_page, "commit")) { cgit_print_commit(cgit_query_sha1); } else if (!strcmp(cgit_query_page, "view")) { - cgit_print_view(cgit_query_sha1); + cgit_print_view(cgit_query_sha1, cgit_query_path); } else if (!strcmp(cgit_query_page, "diff")) { cgit_print_diff(cgit_query_sha1, cgit_query_sha2); } else { cgit_print_error("Invalid request"); @@ -154,9 +154,9 @@ extern void cgit_print_snapshot_start(const char *mimetype, extern void cgit_print_repolist(struct cacheitem *item); extern void cgit_print_summary(); extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep); -extern void cgit_print_view(const char *hex); +extern void cgit_print_view(const char *hex, char *path); extern void cgit_print_tree(const char *hex, char *path); extern void cgit_print_commit(const char *hex); extern void cgit_print_diff(const char *old_hex, const char *new_hex); extern void cgit_print_snapshot(struct cacheitem *item, const char *hex, @@ -7,9 +7,9 @@ */ #include "cgit.h" -void cgit_print_view(const char *hex) +void cgit_print_view(const char *hex, char *path) { unsigned char sha1[20]; enum object_type type; unsigned char *buf; @@ -33,10 +33,15 @@ void cgit_print_view(const char *hex) } buf[size] = '\0'; html("<table class='list'>\n"); - htmlf("<tr class='nohover'><th class='left'>%s %s, %li bytes</th></tr>\n", - typename(type), hex, size); + html("<tr class='nohover'><th class='left'>"); + if (path) + htmlf("%s (", path); + htmlf("%s %s, %li bytes", typename(type), hex, size); + if (path) + html(")"); + html("</th></tr>\n"); html("<tr><td class='blob'>\n"); html_txt(buf); html("\n</td></tr>\n"); html("</table>\n"); |