aboutsummaryrefslogtreecommitdiff
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--cgit.c2
-rw-r--r--cgit.css50
-rw-r--r--cgit.h5
-rw-r--r--parsing.c1
-rw-r--r--ui-commit.c80
-rw-r--r--ui-log.c11
-rw-r--r--ui-tree.c6
-rw-r--r--ui-view.c2
9 files changed, 19 insertions, 140 deletions
diff --git a/Makefile b/Makefile
index 58a583b..2a4d62a 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@ CACHE_ROOT = /var/cache/cgit
EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto
OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
- ui-summary.o ui-log.o ui-view.c ui-tree.c ui-commit.c
+ ui-summary.o ui-log.o ui-view.c ui-tree.c
CFLAGS += -Wall
diff --git a/cgit.c b/cgit.c
index 37cdb83..d7e586d 100644
--- a/cgit.c
+++ b/cgit.c
@@ -32,8 +32,6 @@ static void cgit_print_repo_page(struct cacheitem *item)
cgit_print_log(cgit_query_head, cgit_query_ofs, 100);
} else if (!strcmp(cgit_query_page, "tree")) {
cgit_print_tree(cgit_query_sha1);
- } 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);
}
diff --git a/cgit.css b/cgit.css
index 3579598..97b4e27 100644
--- a/cgit.css
+++ b/cgit.css
@@ -21,15 +21,16 @@ table.list {
}
table.list th {
+ text-align: left;
font-weight: bold;
background: #ddd;
border-bottom: solid 1px #aaa;
- padding: 0.1em 0.5em 0.1em 0.5em;
+ padding: 0.1em 0.5em 0.1em;
vertical-align: baseline;
}
table.list td {
border: none;
- padding: 0.1em 0.5em 0.1em 0.5em;
+ padding: 0.1em 1em 0.1em 0.5em;
background: white;
}
@@ -55,10 +56,6 @@ div#content {
margin: 0.5em 0.5em;
}
-div#blob {
- border: solid 1px black;
-}
-
div.error {
color: red;
font-weight: bold;
@@ -78,43 +75,4 @@ td.blob {
white-space: pre;
font-family: courier;
font-size: 100%;
-}
-
-table.log td {
- white-space: nowrap;
-}
-
-table.commit-info {
- border-collapse: collapse;
- margin-top: 1em;
-
-}
-table.commit-info th {
- text-align: left;
- font-weight: normal;
- padding: 0.1em 1em 0.1em 0.1em;
-}
-table.commit-info td {
- font-weight: normal;
- padding: 0.1em 1em 0.1em 0.1em;
-}
-div.commit-subject {
- font-weight: bold;
- font-size: 110%;
- margin: 1em 0em 1em;
-}
-div.commit-msg {
- white-space: pre;
- font-family: courier;
- font-size: 100%;
-}
-.sha1 {
- font-family: courier;
- font-size: 90%;
-}
-.left {
- text-align: left;
-}
-.right {
- text-align: right;
-}
+} \ No newline at end of file
diff --git a/cgit.h b/cgit.h
index a905e47..268db53 100644
--- a/cgit.h
+++ b/cgit.h
@@ -92,8 +92,7 @@ extern void cgit_print_pageheader(char *title);
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);
-extern void cgit_print_view(const char *hex);
-extern void cgit_print_tree(const char *hex);
-extern void cgit_print_commit(const char *hex);
+extern void cgit_print_view(char *hex);
+extern void cgit_print_tree(const char *sha1);
#endif /* CGIT_H */
diff --git a/parsing.c b/parsing.c
index be471b5..6cab0e9 100644
--- a/parsing.c
+++ b/parsing.c
@@ -150,7 +150,6 @@ struct commitinfo *cgit_parse_commit(struct commit *commit)
t = strchr(p, '\n');
ret->subject = substr(p, t);
- p = t + 1;
while (*p == '\n')
p = strchr(p, '\n') + 1;
diff --git a/ui-commit.c b/ui-commit.c
deleted file mode 100644
index 1c0e7e5..0000000
--- a/ui-commit.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "cgit.h"
-
-void cgit_print_date(unsigned long secs)
-{
- char buf[32];
- struct tm *time;
-
- time = gmtime(&secs);
- strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S", time);
- html_txt(buf);
-
-}
-
-void cgit_print_commit(const char *hex)
-{
- struct commit *commit;
- struct commitinfo *info;
- struct commit_list *p;
- unsigned long size;
- char type[20];
- char *buf;
-
- unsigned char sha1[20];
-
- if (get_sha1(hex, sha1)) {
- cgit_print_error(fmt("Bad object id: %s", hex));
- return;
- }
-
- buf = read_sha1_file(sha1, type, &size);
- if (!buf) {
- cgit_print_error(fmt("Bad object reference: %s", hex));
- return;
- }
-
- commit = lookup_commit(sha1);
- if (!commit) {
- cgit_print_error(fmt("Bad commit reference: %s", hex));
- return;
- }
-
- commit->buffer = buf;
- if (parse_commit_buffer(commit, buf, size)) {
- cgit_print_error(fmt("Malformed commit buffer: %s", hex));
- return;
- }
-
- info = cgit_parse_commit(commit);
-
- html("<table class='commit-info'>\n");
- html("<tr><th>author</th><td colspan='2'>");
- html_txt(info->author);
- html("</td></tr>\n");
- html("<tr><th>committer</th><td>");
- html_txt(info->committer);
- html("</td><td class='right'>");
- cgit_print_date(commit->date);
- html("</td></tr>\n");
- html("<tr><th>tree</th><td colspan='2' class='sha1'><a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "tree", fmt("id=%s", sha1_to_hex(commit->tree->object.sha1))));
- htmlf("'>%s</a></td></tr>\n", sha1_to_hex(commit->tree->object.sha1));
-
- for (p = commit->parents; p ; p = p->next) {
- html("<tr><th>parent</th><td colspan='2' class='sha1'><a href='");
- html_attr(cgit_pageurl(cgit_query_repo, "commit", fmt("id=%s", sha1_to_hex(p->item->object.sha1))));
- htmlf("'>%s</a></td></tr>\n",
- sha1_to_hex(p->item->object.sha1));
- }
- html("</table>\n");
- html("<div class='commit-subject'>");
- html_txt(info->subject);
- html("</div>");
- html("<div class='commit-msg'>");
- html_txt(info->msg);
- html("</div>");
- free(info->author);
- free(info->committer);
- free(info->subject);
- free(info);
-}
diff --git a/ui-log.c b/ui-log.c
index c52af79..31331ef 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -21,12 +21,17 @@ void print_commit(struct commit *commit)
html_txt(buf);
html("</td><td>");
char *qry = fmt("id=%s", sha1_to_hex(commit->object.sha1));
- char *url = cgit_pageurl(cgit_query_repo, "commit", qry);
+ char *url = cgit_pageurl(cgit_query_repo, "view", qry);
html_link_open(url, NULL, NULL);
html_txt(info->subject);
html_link_close();
html("</td><td>");
html_txt(info->author);
+ html("</td><td><a href='");
+ html_attr(cgit_pageurl(cgit_query_repo, "tree",
+ fmt("id=%s",
+ sha1_to_hex(commit->tree->object.sha1))));
+ html("'>tree</a>");
html("</td></tr>\n");
free(info->author);
free(info->committer);
@@ -51,8 +56,8 @@ void cgit_print_log(const char *tip, int ofs, int cnt)
prepare_revision_walk(&rev);
html("<h2>Log</h2>");
- html("<table class='list log'>");
- html("<tr><th class='left'>Date</th><th class='left'>Message</th><th class='left'>Author</th></tr>\n");
+ html("<table class='list'>");
+ html("<tr><th>Date</th><th>Message</th><th>Author</th><th>Link</th></tr>\n");
if (ofs<0)
ofs = 0;
diff --git a/ui-tree.c b/ui-tree.c
index c4d75ab..84930cb 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -62,9 +62,9 @@ void cgit_print_tree(const char *hex)
html("<h2>Tree content</h2>\n");
html("<table class='list'>\n");
- html("<tr><th class='left'>Name</th>");
- html("<th class='right'>Size</th>");
- html("<th class='right'>Mode</th></tr>\n");
+ html("<tr><th>Name</th>");
+ html("<th class='filesize'>Size</th>");
+ html("<th class='filemode'>Mode</th></tr>\n");
read_tree_recursive(tree, "", 0, 1, NULL, print_entry);
html("</table>\n");
}
diff --git a/ui-view.c b/ui-view.c
index b75ce9a..9d13be1 100644
--- 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(char *hex)
{
unsigned char sha1[20];
char type[20];