author | Lars Hjemli <hjemli@gmail.com> | 2008-04-13 10:48:44 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2008-04-13 10:48:44 (UTC) |
commit | 76ba6287bfb533baca7285b107b5d975581d449d (patch) (unidiff) | |
tree | 22445a77f5b87280ec980f9b4da5a511f1f27faf /ui-commit.c | |
parent | 4a842288260a0b0c4a3d4032d441f7fd2afee699 (diff) | |
parent | 28d781f34b2c2d4c2b994ef3953d1cf37d8f28f0 (diff) | |
download | cgit-76ba6287bfb533baca7285b107b5d975581d449d.zip cgit-76ba6287bfb533baca7285b107b5d975581d449d.tar.gz cgit-76ba6287bfb533baca7285b107b5d975581d449d.tar.bz2 |
Merge branch 'lh/layout'
* lh/layout:
Make repository search case insensitive
Remove 'patch' link from tab, add to commit view
Implement minimal freetext search in the repolist
More layout fixes
Minor fixup in tree-view css
Reintroduce the branch switcher
Add fixed link to index page from repo header
Include diff in commit view
Replace sidebar/logo
-rw-r--r-- | ui-commit.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ui-commit.c b/ui-commit.c index 8019e36..dd36cc0 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -1,27 +1,28 @@ | |||
1 | /* ui-commit.c: generate commit view | 1 | /* ui-commit.c: generate commit view |
2 | * | 2 | * |
3 | * Copyright (C) 2006 Lars Hjemli | 3 | * Copyright (C) 2006 Lars Hjemli |
4 | * | 4 | * |
5 | * Licensed under GNU General Public License v2 | 5 | * Licensed under GNU General Public License v2 |
6 | * (see COPYING for full license text) | 6 | * (see COPYING for full license text) |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include "cgit.h" | 9 | #include "cgit.h" |
10 | #include "html.h" | 10 | #include "html.h" |
11 | #include "ui-shared.h" | 11 | #include "ui-shared.h" |
12 | #include "ui-diff.h" | ||
12 | 13 | ||
13 | static int files, slots; | 14 | static int files, slots; |
14 | static int total_adds, total_rems, max_changes; | 15 | static int total_adds, total_rems, max_changes; |
15 | static int lines_added, lines_removed; | 16 | static int lines_added, lines_removed; |
16 | static char *curr_rev; | 17 | static char *curr_rev; |
17 | 18 | ||
18 | static struct fileinfo { | 19 | static struct fileinfo { |
19 | char status; | 20 | char status; |
20 | unsigned char old_sha1[20]; | 21 | unsigned char old_sha1[20]; |
21 | unsigned char new_sha1[20]; | 22 | unsigned char new_sha1[20]; |
22 | unsigned short old_mode; | 23 | unsigned short old_mode; |
23 | unsigned short new_mode; | 24 | unsigned short new_mode; |
24 | char *old_path; | 25 | char *old_path; |
25 | char *new_path; | 26 | char *new_path; |
26 | unsigned int added; | 27 | unsigned int added; |
27 | unsigned int removed; | 28 | unsigned int removed; |
@@ -161,32 +162,38 @@ void cgit_print_commit(char *hex) | |||
161 | 162 | ||
162 | html("<table summary='commit info' class='commit-info'>\n"); | 163 | html("<table summary='commit info' class='commit-info'>\n"); |
163 | html("<tr><th>author</th><td>"); | 164 | html("<tr><th>author</th><td>"); |
164 | html_txt(info->author); | 165 | html_txt(info->author); |
165 | html(" "); | 166 | html(" "); |
166 | html_txt(info->author_email); | 167 | html_txt(info->author_email); |
167 | html("</td><td class='right'>"); | 168 | html("</td><td class='right'>"); |
168 | cgit_print_date(info->author_date, FMT_LONGDATE); | 169 | cgit_print_date(info->author_date, FMT_LONGDATE); |
169 | html("</td></tr>\n"); | 170 | html("</td></tr>\n"); |
170 | html("<tr><th>committer</th><td>"); | 171 | html("<tr><th>committer</th><td>"); |
171 | html_txt(info->committer); | 172 | html_txt(info->committer); |
172 | html(" "); | 173 | html(" "); |
173 | html_txt(info->committer_email); | 174 | html_txt(info->committer_email); |
174 | html("</td><td class='right'>"); | 175 | html("</td><td class='right'>"); |
175 | cgit_print_date(info->committer_date, FMT_LONGDATE); | 176 | cgit_print_date(info->committer_date, FMT_LONGDATE); |
176 | html("</td></tr>\n"); | 177 | html("</td></tr>\n"); |
178 | html("<tr><th>commit</th><td colspan='2' class='sha1'>"); | ||
179 | tmp = sha1_to_hex(commit->object.sha1); | ||
180 | cgit_commit_link(tmp, NULL, NULL, ctx.qry.head, tmp); | ||
181 | html(" ("); | ||
182 | cgit_patch_link("patch", NULL, NULL, NULL, tmp); | ||
183 | html(")</td></tr>\n"); | ||
177 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 184 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
178 | tmp = xstrdup(hex); | 185 | tmp = xstrdup(hex); |
179 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, | 186 | cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, |
180 | ctx.qry.head, tmp, NULL); | 187 | ctx.qry.head, tmp, NULL); |
181 | html("</td></tr>\n"); | 188 | html("</td></tr>\n"); |
182 | for (p = commit->parents; p ; p = p->next) { | 189 | for (p = commit->parents; p ; p = p->next) { |
183 | parent = lookup_commit_reference(p->item->object.sha1); | 190 | parent = lookup_commit_reference(p->item->object.sha1); |
184 | if (!parent) { | 191 | if (!parent) { |
185 | html("<tr><td colspan='3'>"); | 192 | html("<tr><td colspan='3'>"); |
186 | cgit_print_error("Error reading parent commit"); | 193 | cgit_print_error("Error reading parent commit"); |
187 | html("</td></tr>"); | 194 | html("</td></tr>"); |
188 | continue; | 195 | continue; |
189 | } | 196 | } |
190 | html("<tr><th>parent</th>" | 197 | html("<tr><th>parent</th>" |
191 | "<td colspan='2' class='sha1'>"); | 198 | "<td colspan='2' class='sha1'>"); |
192 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, | 199 | cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, |
@@ -205,24 +212,25 @@ void cgit_print_commit(char *hex) | |||
205 | html("</table>\n"); | 212 | html("</table>\n"); |
206 | html("<div class='commit-subject'>"); | 213 | html("<div class='commit-subject'>"); |
207 | html_txt(info->subject); | 214 | html_txt(info->subject); |
208 | html("</div>"); | 215 | html("</div>"); |
209 | html("<div class='commit-msg'>"); | 216 | html("<div class='commit-msg'>"); |
210 | html_txt(info->msg); | 217 | html_txt(info->msg); |
211 | html("</div>"); | 218 | html("</div>"); |
212 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { | 219 | if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { |
213 | html("<div class='diffstat-header'>Diffstat</div>"); | 220 | html("<div class='diffstat-header'>Diffstat</div>"); |
214 | html("<table summary='diffstat' class='diffstat'>"); | 221 | html("<table summary='diffstat' class='diffstat'>"); |
215 | max_changes = 0; | 222 | max_changes = 0; |
216 | cgit_diff_commit(commit, inspect_filepair); | 223 | cgit_diff_commit(commit, inspect_filepair); |
217 | for(i = 0; i<files; i++) | 224 | for(i = 0; i<files; i++) |
218 | print_fileinfo(&items[i]); | 225 | print_fileinfo(&items[i]); |
219 | html("</table>"); | 226 | html("</table>"); |
220 | html("<div class='diffstat-summary'>"); | 227 | html("<div class='diffstat-summary'>"); |
221 | htmlf("%d files changed, %d insertions, %d deletions (", | 228 | htmlf("%d files changed, %d insertions, %d deletions", |
222 | files, total_adds, total_rems); | 229 | files, total_adds, total_rems); |
223 | cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex, | 230 | cgit_print_diff(ctx.qry.sha1, |
224 | NULL, NULL); | 231 | sha1_to_hex(commit->parents->item->object.sha1), |
232 | NULL); | ||
225 | html(")</div>"); | 233 | html(")</div>"); |
226 | } | 234 | } |
227 | cgit_free_commitinfo(info); | 235 | cgit_free_commitinfo(info); |
228 | } | 236 | } |