]> granicus.if.org Git - cgit/commitdiff
ui-view: show pathname if specified in querystring
authorLars Hjemli <hjemli@gmail.com>
Tue, 8 May 2007 21:52:56 +0000 (23:52 +0200)
committerLars Hjemli <hjemli@gmail.com>
Tue, 8 May 2007 21:52:56 +0000 (23:52 +0200)
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit.c
cgit.h
ui-view.c

diff --git a/cgit.c b/cgit.c
index fedf3553a8b2db860bb2b2750a6f3bb82dd9b7b3..6dddcbbc91896555330f749592b47b1f111f7547 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -109,7 +109,7 @@ static void cgit_print_repo_page(struct cacheitem *item)
        } 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 {
diff --git a/cgit.h b/cgit.h
index 222c9c21a80912142a87358d362f07f11d7fb0a0..26152310e62e43f624b4510df79e64be2564aaf4 100644 (file)
--- a/cgit.h
+++ b/cgit.h
@@ -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_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);
index 9d23c453d79cff971e35d074002099b2f6c3e22e..7d022fdf501dc06b1bf9f641b29715466967d98a 100644 (file)
--- a/ui-view.c
+++ b/ui-view.c
@@ -8,7 +8,7 @@
 
 #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;
@@ -34,8 +34,13 @@ 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");