ui-view: show pathname if specified in querystring

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Lars Hjemli 2007-05-08 23:52:56 +02:00
parent 61c3ca978c
commit 7250a15467
3 changed files with 10 additions and 5 deletions

2
cgit.c
View File

@ -109,7 +109,7 @@ static void cgit_print_repo_page(struct cacheitem *item)
} else if (!strcmp(cgit_query_page, "commit")) { } else if (!strcmp(cgit_query_page, "commit")) {
cgit_print_commit(cgit_query_sha1); cgit_print_commit(cgit_query_sha1);
} else if (!strcmp(cgit_query_page, "view")) { } 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")) { } else if (!strcmp(cgit_query_page, "diff")) {
cgit_print_diff(cgit_query_sha1, cgit_query_sha2); cgit_print_diff(cgit_query_sha1, cgit_query_sha2);
} else { } else {

2
cgit.h
View File

@ -155,7 +155,7 @@ extern void cgit_print_snapshot_start(const char *mimetype,
extern void cgit_print_repolist(struct cacheitem *item); extern void cgit_print_repolist(struct cacheitem *item);
extern void cgit_print_summary(); extern void cgit_print_summary();
extern void cgit_print_log(const char *tip, int ofs, int cnt, char *grep); 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_tree(const char *hex, char *path);
extern void cgit_print_commit(const char *hex); 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_diff(const char *old_hex, const char *new_hex);

View File

@ -8,7 +8,7 @@
#include "cgit.h" #include "cgit.h"
void cgit_print_view(const char *hex) void cgit_print_view(const char *hex, char *path)
{ {
unsigned char sha1[20]; unsigned char sha1[20];
enum object_type type; enum object_type type;
@ -34,8 +34,13 @@ void cgit_print_view(const char *hex)
buf[size] = '\0'; buf[size] = '\0';
html("<table class='list'>\n"); html("<table class='list'>\n");
htmlf("<tr class='nohover'><th class='left'>%s %s, %li bytes</th></tr>\n", html("<tr class='nohover'><th class='left'>");
typename(type), hex, size); 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("<tr><td class='blob'>\n");
html_txt(buf); html_txt(buf);
html("\n</td></tr>\n"); html("\n</td></tr>\n");