]> gitweb.ps.run Git - ps-cgit/blobdiff - ui-view.c
Update to libgit 1.5.2-rc2
[ps-cgit] / ui-view.c
index 1bf84722b75da0896d2817b635f75e875bc7a4f2..9d23c453d79cff971e35d074002099b2f6c3e22e 100644 (file)
--- a/ui-view.c
+++ b/ui-view.c
@@ -8,10 +8,10 @@
 
 #include "cgit.h"
 
-void cgit_print_view(char *hex)
+void cgit_print_view(const char *hex)
 {
        unsigned char sha1[20];
-       char type[20];
+       enum object_type type;
        unsigned char *buf;
        unsigned long size;
 
@@ -20,21 +20,24 @@ void cgit_print_view(char *hex)
                return;
        }
 
-       if (sha1_object_info(sha1, type, &size)){
-               cgit_print_error("Bad object name");
+       type = sha1_object_info(sha1, &size);
+       if (type == OBJ_BAD) {
+               cgit_print_error(fmt("Bad object name: %s", hex));
                return;
        }
 
-       buf = read_sha1_file(sha1, type, &size);
+       buf = read_sha1_file(sha1, &type, &size);
        if (!buf) {
-               cgit_print_error("Error reading object");
+               cgit_print_error(fmt("Error reading object %s", hex));
                return;
        }
 
        buf[size] = '\0';
-       html("<h2>Object view</h2>");
-       htmlf("sha1=%s<br/>type=%s<br/>size=%i<br/>", hex, type, size);
-       html("<pre>");
+       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><td class='blob'>\n");
        html_txt(buf);
-       html("</pre>");
+       html("\n</td></tr>\n");
+       html("</table>\n");
 }