summaryrefslogtreecommitdiffabout
authorLars Hjemli <hjemli@gmail.com>2008-11-29 17:39:41 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2008-11-29 17:39:41 (UTC)
commit0274b57d55a12ed38259757dbfae96b79cfa2e0b (patch) (unidiff)
tree34c7204f88168f791ef48f603bb8ab66e9df523c
parent7b5cee65fd9cf31e4f19ce4ff613778cb95512a9 (diff)
downloadcgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.zip
cgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.tar.gz
cgit-0274b57d55a12ed38259757dbfae96b79cfa2e0b.tar.bz2
ui-log: add support for showing the full commit message
Some users prefer to see the full message, so to make these users happy the new querystring parameter "showmsg" can be used to print the full commit message per log entry. A link is provided in the log heading to make this function accessible, and all links and forms tries to preserve the users preference. Note: the new link is not displayed on the summary page since the point of the summary page is to be a summary, but it is still obeyed if specified manually. Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c2
-rw-r--r--cgit.h1
-rw-r--r--ui-log.c32
-rw-r--r--ui-refs.c3
-rw-r--r--ui-repolist.c2
-rw-r--r--ui-shared.c12
-rw-r--r--ui-shared.h2
-rw-r--r--ui-tree.c2
8 files changed, 45 insertions, 11 deletions
diff --git a/cgit.c b/cgit.c
index c82587b..db5d342 100644
--- a/cgit.c
+++ b/cgit.c
@@ -155,4 +155,6 @@ static void querystring_cb(const char *name, const char *value)
155 } else if (!strcmp(name, "mimetype")) { 155 } else if (!strcmp(name, "mimetype")) {
156 ctx.qry.mimetype = xstrdup(value); 156 ctx.qry.mimetype = xstrdup(value);
157 } else if (!strcmp(name, "showmsg")) {
158 ctx.qry.showmsg = atoi(value);
157 } 159 }
158} 160}
diff --git a/cgit.h b/cgit.h
index 91db98a..aab898b 100644
--- a/cgit.h
+++ b/cgit.h
@@ -122,4 +122,5 @@ struct cgit_query {
122 int ofs; 122 int ofs;
123 int nohead; 123 int nohead;
124 int showmsg;
124}; 125};
125 126
diff --git a/ui-log.c b/ui-log.c
index 8dd8b89..631e46d 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -45,6 +45,10 @@ void print_commit(struct commit *commit)
45 html_link_close(); 45 html_link_close();
46 html("</td><td>"); 46 html("</td><td>");
47 if (ctx.qry.showmsg)
48 html("<u>");
47 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head, 49 cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
48 sha1_to_hex(commit->object.sha1)); 50 sha1_to_hex(commit->object.sha1));
51 if (ctx.qry.showmsg)
52 html("</u>");
49 html("</td><td>"); 53 html("</td><td>");
50 html_txt(info->author); 54 html_txt(info->author);
@@ -62,4 +66,15 @@ void print_commit(struct commit *commit)
62 } 66 }
63 html("</td></tr>\n"); 67 html("</td></tr>\n");
68 if (ctx.qry.showmsg) {
69 html("<tr class='nohover'><td></td><td><div class='commit-msg'>");
70 html_txt(info->msg);
71 html("</div><br/></td><td></td>");
72 if (ctx.repo->enable_log_filecount) {
73 html("<td></td>");
74 if (ctx.repo->enable_log_linecount)
75 html("<td></td>");
76 }
77 html("</tr>\n");
78 }
64 cgit_free_commitinfo(info); 79 cgit_free_commitinfo(info);
65} 80}
@@ -101,6 +116,13 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
101 116
102 html("<tr class='nohover'><th class='left'>Age</th>" 117 html("<tr class='nohover'><th class='left'>Age</th>"
103 "<th class='left'>Commit message</th>" 118 "<th class='left'>Commit message");
104 "<th class='left'>Author</th>"); 119 if (pager) {
120 html(" (");
121 cgit_log_link("toggle", NULL, NULL, ctx.qry.head, ctx.qry.sha1,
122 ctx.qry.path, ctx.qry.ofs, ctx.qry.grep,
123 ctx.qry.search, ctx.qry.showmsg ? 0 : 1);
124 html(")");
125 }
126 html("</th><th class='left'>Author</th>");
105 if (ctx.repo->enable_log_filecount) { 127 if (ctx.repo->enable_log_filecount) {
106 html("<th class='left'>Files</th>"); 128 html("<th class='left'>Files</th>");
@@ -137,5 +159,5 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
137 ctx.qry.sha1, ctx.qry.path, 159 ctx.qry.sha1, ctx.qry.path,
138 ofs - cnt, ctx.qry.grep, 160 ofs - cnt, ctx.qry.grep,
139 ctx.qry.search); 161 ctx.qry.search, ctx.qry.showmsg);
140 html("&nbsp;"); 162 html("&nbsp;");
141 } 163 }
@@ -144,5 +166,5 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
144 ctx.qry.sha1, ctx.qry.path, 166 ctx.qry.sha1, ctx.qry.path,
145 ofs + cnt, ctx.qry.grep, 167 ofs + cnt, ctx.qry.grep,
146 ctx.qry.search); 168 ctx.qry.search, ctx.qry.showmsg);
147 } 169 }
148 html("</div>"); 170 html("</div>");
@@ -150,5 +172,5 @@ void cgit_print_log(const char *tip, int ofs, int cnt, char *grep, char *pattern
150 html("<tr class='nohover'><td colspan='3'>"); 172 html("<tr class='nohover'><td colspan='3'>");
151 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0, 173 cgit_log_link("[...]", NULL, NULL, ctx.qry.head, NULL, NULL, 0,
152 NULL, NULL); 174 NULL, NULL, ctx.qry.showmsg);
153 html("</td></tr>\n"); 175 html("</td></tr>\n");
154 } 176 }
diff --git a/ui-refs.c b/ui-refs.c
index 32e0429..7eb16d5 100644
--- a/ui-refs.c
+++ b/ui-refs.c
@@ -59,5 +59,6 @@ static int print_branch(struct refinfo *ref)
59 return 1; 59 return 1;
60 html("<tr><td>"); 60 html("<tr><td>");
61 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL); 61 cgit_log_link(name, NULL, NULL, name, NULL, NULL, 0, NULL, NULL,
62 ctx.qry.showmsg);
62 html("</td><td>"); 63 html("</td><td>");
63 64
diff --git a/ui-repolist.c b/ui-repolist.c
index c23232c..5833140 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -147,5 +147,5 @@ void cgit_print_repolist()
147 cgit_summary_link("summary", NULL, "button", NULL); 147 cgit_summary_link("summary", NULL, "button", NULL);
148 cgit_log_link("log", NULL, "button", NULL, NULL, NULL, 148 cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
149 0, NULL, NULL); 149 0, NULL, NULL, ctx.qry.showmsg);
150 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL); 150 cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
151 html("</td>"); 151 html("</td>");
diff --git a/ui-shared.c b/ui-shared.c
index 224e5f3..dc39e64 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -282,5 +282,6 @@ void cgit_plain_link(char *name, char *title, char *class, char *head,
282 282
283void cgit_log_link(char *name, char *title, char *class, char *head, 283void cgit_log_link(char *name, char *title, char *class, char *head,
284 char *rev, char *path, int ofs, char *grep, char *pattern) 284 char *rev, char *path, int ofs, char *grep, char *pattern,
285 int showmsg)
285{ 286{
286 char *delim; 287 char *delim;
@@ -306,4 +307,9 @@ void cgit_log_link(char *name, char *title, char *class, char *head,
306 html("ofs="); 307 html("ofs=");
307 htmlf("%d", ofs); 308 htmlf("%d", ofs);
309 delim = "&";
310 }
311 if (showmsg) {
312 html(delim);
313 html("showmsg=1");
308 } 314 }
309 html("'>"); 315 html("'>");
@@ -569,4 +575,6 @@ void add_hidden_formfields(int incl_head, int incl_search, char *page)
569 if (ctx.qry.sha2) 575 if (ctx.qry.sha2)
570 html_hidden("id2", ctx.qry.sha2); 576 html_hidden("id2", ctx.qry.sha2);
577 if (ctx.qry.showmsg)
578 html_hidden("showmsg", "1");
571 579
572 if (incl_search) { 580 if (incl_search) {
@@ -635,5 +643,5 @@ void cgit_print_pageheader(struct cgit_context *ctx)
635 ctx->qry.sha1, NULL); 643 ctx->qry.sha1, NULL);
636 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head, 644 cgit_log_link("log", NULL, hc(cmd, "log"), ctx->qry.head,
637 NULL, NULL, 0, NULL, NULL); 645 NULL, NULL, 0, NULL, NULL, ctx->qry.showmsg);
638 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head, 646 cgit_tree_link("tree", NULL, hc(cmd, "tree"), ctx->qry.head,
639 ctx->qry.sha1, NULL); 647 ctx->qry.sha1, NULL);
diff --git a/ui-shared.h b/ui-shared.h
index 3c8a6d0..2ab53ae 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -20,5 +20,5 @@ extern void cgit_plain_link(char *name, char *title, char *class, char *head,
20extern void cgit_log_link(char *name, char *title, char *class, char *head, 20extern void cgit_log_link(char *name, char *title, char *class, char *head,
21 char *rev, char *path, int ofs, char *grep, 21 char *rev, char *path, int ofs, char *grep,
22 char *pattern); 22 char *pattern, int showmsg);
23extern void cgit_commit_link(char *name, char *title, char *class, char *head, 23extern void cgit_commit_link(char *name, char *title, char *class, char *head,
24 char *rev); 24 char *rev);
diff --git a/ui-tree.c b/ui-tree.c
index 79332fc..051db7c 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -107,5 +107,5 @@ static int ls_item(const unsigned char *sha1, const char *base, int baselen,
107 html("<td>"); 107 html("<td>");
108 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev, 108 cgit_log_link("log", NULL, "button", ctx.qry.head, curr_rev,
109 fullpath, 0, NULL, NULL); 109 fullpath, 0, NULL, NULL, ctx.qry.showmsg);
110 html("</td></tr>\n"); 110 html("</td></tr>\n");
111 free(name); 111 free(name);