author | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 23:16:56 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2007-05-15 23:16:56 (UTC) |
commit | dff894d12953a8a3cd7cdca2357771212a2f57d6 (patch) (unidiff) | |
tree | 042f1fbc0594d61d97721167197506760847ce2a /ui-commit.c | |
parent | f9ff7df613b4ee86fe5914c4ae3400650882c03d (diff) | |
download | cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.zip cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.tar.gz cgit-dff894d12953a8a3cd7cdca2357771212a2f57d6.tar.bz2 |
Add link to commitdiff below diffstat
This link is a lot easier to locate than the links to the right of the
parent entries.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-commit.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ui-commit.c b/ui-commit.c index 93eb8fd..ff1fad3 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -192,45 +192,49 @@ void cgit_print_commit(const char *hex) | |||
192 | html("<tr><td colspan='3'>"); | 192 | html("<tr><td colspan='3'>"); |
193 | cgit_print_error("Error reading parent commit"); | 193 | cgit_print_error("Error reading parent commit"); |
194 | html("</td></tr>"); | 194 | html("</td></tr>"); |
195 | continue; | 195 | continue; |
196 | } | 196 | } |
197 | html("<tr><th>parent</th>" | 197 | html("<tr><th>parent</th>" |
198 | "<td colspan='2' class='sha1'>" | 198 | "<td colspan='2' class='sha1'>" |
199 | "<a href='"); | 199 | "<a href='"); |
200 | query = fmt("h=%s", sha1_to_hex(p->item->object.sha1)); | 200 | query = fmt("h=%s", sha1_to_hex(p->item->object.sha1)); |
201 | html_attr(cgit_pageurl(cgit_query_repo, "commit", query)); | 201 | html_attr(cgit_pageurl(cgit_query_repo, "commit", query)); |
202 | htmlf("'>%s</a> (<a href='", | 202 | htmlf("'>%s</a> (<a href='", |
203 | sha1_to_hex(p->item->object.sha1)); | 203 | sha1_to_hex(p->item->object.sha1)); |
204 | query = fmt("id=%s&id2=%s", sha1_to_hex(parent->tree->object.sha1), | 204 | query = fmt("id=%s&id2=%s", sha1_to_hex(parent->tree->object.sha1), |
205 | sha1_to_hex(commit->tree->object.sha1)); | 205 | sha1_to_hex(commit->tree->object.sha1)); |
206 | html_attr(cgit_pageurl(cgit_query_repo, "diff", query)); | 206 | html_attr(cgit_pageurl(cgit_query_repo, "diff", query)); |
207 | html("'>diff</a>)</td></tr>"); | 207 | html("'>diff</a>)</td></tr>"); |
208 | } | 208 | } |
209 | if (cgit_repo->snapshots) { | 209 | if (cgit_repo->snapshots) { |
210 | htmlf("<tr><th>download</th><td colspan='2' class='sha1'><a href='"); | 210 | htmlf("<tr><th>download</th><td colspan='2' class='sha1'><a href='"); |
211 | filename = fmt("%s-%s.zip", cgit_query_repo, hex); | 211 | filename = fmt("%s-%s.zip", cgit_query_repo, hex); |
212 | html_attr(cgit_pageurl(cgit_query_repo, "snapshot", | 212 | html_attr(cgit_pageurl(cgit_query_repo, "snapshot", |
213 | fmt("id=%s&name=%s", hex, filename))); | 213 | fmt("id=%s&name=%s", hex, filename))); |
214 | htmlf("'>%s</a></td></tr>", filename); | 214 | htmlf("'>%s</a></td></tr>", filename); |
215 | } | 215 | } |
216 | html("</table>\n"); | 216 | html("</table>\n"); |
217 | html("<div class='commit-subject'>"); | 217 | html("<div class='commit-subject'>"); |
218 | html_txt(info->subject); | 218 | html_txt(info->subject); |
219 | html("</div>"); | 219 | html("</div>"); |
220 | html("<div class='commit-msg'>"); | 220 | html("<div class='commit-msg'>"); |
221 | html_txt(info->msg); | 221 | html_txt(info->msg); |
222 | html("</div>"); | 222 | html("</div>"); |
223 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { | 223 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { |
224 | html("<div class='diffstat-header'>Diffstat</div>"); | ||
224 | html("<table class='diffstat'>"); | 225 | html("<table class='diffstat'>"); |
225 | max_changes = 0; | 226 | max_changes = 0; |
226 | cgit_diff_commit(commit, inspect_filepair); | 227 | cgit_diff_commit(commit, inspect_filepair); |
227 | for(i = 0; i<files; i++) | 228 | for(i = 0; i<files; i++) |
228 | print_fileinfo(&items[i]); | 229 | print_fileinfo(&items[i]); |
229 | html("</table>"); | 230 | html("</table>"); |
230 | html("<div class='diffstat-summary'>"); | 231 | html("<div class='diffstat-summary'>"); |
231 | htmlf("%d files changed, %d insertions, %d deletions\n", | 232 | htmlf("%d files changed, %d insertions, %d deletions (", |
232 | files, total_adds, total_rems); | 233 | files, total_adds, total_rems); |
234 | query = fmt("h=%s", hex); | ||
235 | html_link_open(cgit_pageurl(cgit_query_repo, "diff", query), NULL, NULL); | ||
236 | html("show diff</a>)"); | ||
233 | html("</div>"); | 237 | html("</div>"); |
234 | } | 238 | } |
235 | cgit_free_commitinfo(info); | 239 | cgit_free_commitinfo(info); |
236 | } | 240 | } |