Author: Lars Hjemli <hjemli@gmail.com>
Merge branch 'full-log' Conflicts: cgit.c cgit.h
cgit.c | 2 ++ cgit.css | 15 +++++++++++++++ cgit.h | 1 + ui-log.c | 35 ++++++++++++++++++++++++++++------- ui-refs.c | 3 ++- ui-repolist.c | 2 +- ui-shared.c | 12 ++++++++++-- ui-shared.h | 2 +- ui-tree.c | 2 +-
diff --git a/cgit.c b/cgit.c
index e09c86eaae248ead1fbcca8ee51224b98ccf94af..166fbc649607fcc1872eb61c6c0cd2b7e7c6de31 100644
--- a/cgit.c
+++ b/cgit.c
@@ -156,6 +156,8 @@ } else if (!strcmp(name, "mimetype")) {
ctx.qry.mimetype = xstrdup(value);
} else if (!strcmp(name, "s")){
ctx.qry.sort = xstrdup(value);
+ } else if (!strcmp(name, "showmsg")) {
+ ctx.qry.showmsg = atoi(value);
}
}
diff --git a/cgit.css b/cgit.css
index a37d21816cdbe213e1efb6b084ecece66aa4f0f3..7928c2f4f86f0b597a3b992ff7815adca1d4bef0 100644
--- a/cgit.css
+++ b/cgit.css
@@ -120,6 +120,10 @@ table.list tr {
background: white;
}
+table.list tr.logheader {
+ background: #eee;
+}
+
table.list tr:hover {
background: #eee;
}
@@ -141,6 +145,17 @@
table.list td {
border: none;
padding: 0.1em 0.5em 0.1em 0.5em;
+}
+
+table.list td.logsubject {
+ font-family: monospace;
+ font-weight: bold;
+}
+
+table.list td.logmsg {
+ font-family: monospace;
+ white-space: pre;
+ padding: 1em 0em 2em 0em;
}
table.list td a {
diff --git a/cgit.h b/cgit.h
index f1fbeca0be7f08dc70221cb2d7cac433df039901..cb2f176f621f52d60489dd817d2776411360b3bf 100644
--- a/cgit.h
+++ b/cgit.h
@@ -123,6 +123,7 @@ char *url;
int ofs;
int nohead;
char *sort;
+ int showmsg;
};
struct cgit_config {
diff --git a/ui-log.c b/ui-log.c
index d2129844032d59aebfa8172c3a6f34e8ad85c2cf..2f90778c70b22d80a6282eea60190f2cdf78c521 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -35,15 +35,18 @@ void print_commit(struct commit *commit)
{
struct commitinfo *info;
char *tmp;
+ int cols = 2;
info = cgit_parse_commit(commit);
- html("<tr><td>");
+ htmlf("<tr%s><td>",
+ ctx.qry.showmsg ? " class='logheader'" : "");
tmp = fmt("id=%s", sha1_to_hex(commit->object.sha1));
tmp = cgit_pageurl(ctx.repo->url, "commit", tmp);
html_link_open(tmp, NULL, NULL);
cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
html_link_close();
- html("</td><td>");
+ htmlf("</td><td%s>",
+ ctx.qry.showmsg ? " class='logsubject'" : "");
cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
sha1_to_hex(commit->object.sha1));
html("</td><td>");
@@ -61,6 +64,17 @@ htmlf("-%d/+%d", rem_lines, add_lines);
}
}
html("</td></tr>\n");
+ if (ctx.qry.showmsg) {
+ if (ctx.repo->enable_log_filecount) {
+ cols++;
+ if (ctx.repo->enable_log_linecount)
+ cols++;
+ }
+ htmlf("<tr class='nohover'><td/><td colspan='%d' class='logmsg'>",
+ cols);
+ html_txt(info->msg);
+ html("</td></tr>\n");
+ }
cgit_free_commitinfo(info);
}
@@ -113,8 +127,15 @@ if (pager)
html("<table class='list nowrap'>");
html("<tr class='nohover'><th class='left'>Age</th>"
- "<th class='left'>Commit message</th>"
- "<th class='left'>Author</th>");
+ "<th class='left'>Commit message");
+ if (pager) {
+ html(" (");
+ cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
+ ctx.qry.path, ctx.qry.ofs, ctx.qry.grep,
+ ctx.qry.search, ctx.qry.showmsg ? 0 : 1);
+ html(")");
+ }
+ html("</th><th class='left'>Author</th>");
if (ctx.repo->enable_log_filecount) {
html("<th class='left'>Files</th>");
columns++;
@@ -149,20 +170,20 @@ if (ofs > 0) {
cgit_log_link("[prev]", NULL, NULL, ctx.qry.head,
ctx.qry.sha1, ctx.qry.path,
ofs - cnt, ctx.qry.grep,
- ctx.qry.search);
+ ctx.qry.search, ctx.qry.showmsg);
html(" ");
}
if ((commit = get_revision(&rev)) != NULL) {
cgit_log_link("[next]", NULL, NULL, ctx.qry.head,
ctx.qry.sha1, ctx.qry.path,
ofs + cnt, ctx.qry.grep,
- ctx.qry.search);
+ ctx.qry.search, ctx.qry.showmsg);
}
html("</div>");
} else if ((commit = get_revision(&rev)) != NULL) {
html("<tr class='nohover'><td colspan='3'>");
cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0,
- NULL, NULL);
+ NULL, NULL, ctx.qry.showmsg);
html("</td></tr>\n");
}
}
diff --git a/ui-refs.c b/ui-refs.c
index 0805fc8e00522373e8527580eb9e12cec5d4cc4d..d61ee7c8d150d1adf5da535148bf9a1114f1440a 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -58,7 +58,8 @@
if (!info)
return 1;
html("<tr><td>");
- cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL);
+ cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
+ ctx.qry.showmsg);
html("</td><td>");
if (ref->object->type == OBJ_COMMIT) {
diff --git a/ui-repolist.c b/ui-repolist.c
index 87196f048548e4c0627b62c67811a102dbc939b6..2c13d5041b2a4931358b241b6316db3d96a9a6b5 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -257,7 +257,7 @@ if (ctx.cfg.enable_index_links) {
html("<td>");
cgit_summary_link("summary", NULL, "button", NULL);
cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
- 0, NULL, NULL);
+ 0, NULL, NULL, ctx.qry.showmsg);
cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
html("</td>");
}
diff --git a/ui-shared.c b/ui-shared.c
index 9319881de108132650bc026bd90f3548162bdbd7..95dfeb443e7b41ad2bf438a93396bc90adebc38e 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -281,7 +281,8 @@ reporevlink("plain", name, title, class, head, rev, path);
}
void cgit_log_link(char *name, char *title, char *class, char *head,
- char *rev, char *path, int ofs, char *grep, char *pattern)
+ char *rev, char *path, int ofs, char *grep, char *pattern,
+ int showmsg)
{
char *delim;
@@ -305,6 +306,11 @@ if (ofs > 0) {
html(delim);
html("ofs=");
htmlf("%d", ofs);
+ delim = "&";
+ }
+ if (showmsg) {
+ html(delim);
+ html("showmsg=1");
}
html("'>");
html_txt(name);
@@ -570,6 +576,8 @@ if (ctx.qry.sha1)
html_hidden("id", ctx.qry.sha1);
if (ctx.qry.sha2)
html_hidden("id2", ctx.qry.sha2);
+ if (ctx.qry.showmsg)
+ html_hidden("showmsg", "1");
if (incl_search) {
if (ctx.qry.grep)
@@ -636,7 +644,7 @@ ctx->qry.head);
cgit_refs_link("refs", NULL, hc(cmd, "refs"), ctx->qry.head,
ctx->qry.sha1, NULL);
cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
- NULL, NULL, 0, NULL, NULL);
+ NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
ctx->qry.sha1, NULL);
cgit_commit_link("commit", NULL, hc(cmd, "commit"),
diff --git a/ui-shared.h b/ui-shared.h
index 3c8a6d09ad5db04475235d73cf32518f5a555be0..2ab53ae215b00b749fefcc13d95ca738491ca7ae 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -19,7 +19,7 @@ extern void cgit_plain_link(char *name, char *title, char *class, char *head,
char *rev, char *path);
extern void cgit_log_link(char *name, char *title, char *class, char *head,
char *rev, char *path, int ofs, char *grep,
- char *pattern);
+ char *pattern, int showmsg);
extern void cgit_commit_link(char *name, char *title, char *class, char *head,
char *rev);
extern void cgit_patch_link(char *name, char *title, char *class, char *head,
diff --git a/ui-tree.c b/ui-tree.c
index 79332fc9eb22cc83bf4a098abcaf32102862b4d1..051db7cb28cbf2321ca67582aac866596743a465 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -106,7 +106,7 @@ htmlf("%li ", size);
html("<td>");
cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
- fullpath, 0, NULL, NULL);
+ fullpath, 0, NULL, NULL, ctx.qry.showmsg);
html("</td></tr>\n");
free(name);
return 0;