summaryrefslogtreecommitdiffabout
path: root/ui-commit.c
Unidiff
Diffstat (limited to 'ui-commit.c') (more/less context) (show whitespace changes)
-rw-r--r--ui-commit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ui-commit.c b/ui-commit.c
index 3b0919b..25721ca 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -149,78 +149,78 @@ void cgit_print_commit(char *hex)
149 if (get_sha1(hex, sha1)) { 149 if (get_sha1(hex, sha1)) {
150 cgit_print_error(fmt("Bad object id: %s", hex)); 150 cgit_print_error(fmt("Bad object id: %s", hex));
151 return; 151 return;
152 } 152 }
153 commit = lookup_commit_reference(sha1); 153 commit = lookup_commit_reference(sha1);
154 if (!commit) { 154 if (!commit) {
155 cgit_print_error(fmt("Bad commit reference: %s", hex)); 155 cgit_print_error(fmt("Bad commit reference: %s", hex));
156 return; 156 return;
157 } 157 }
158 info = cgit_parse_commit(commit); 158 info = cgit_parse_commit(commit);
159 159
160 html("<table summary='commit info' class='commit-info'>\n"); 160 html("<table summary='commit info' class='commit-info'>\n");
161 html("<tr><th>author</th><td>"); 161 html("<tr><th>author</th><td>");
162 html_txt(info->author); 162 html_txt(info->author);
163 html(" "); 163 html(" ");
164 html_txt(info->author_email); 164 html_txt(info->author_email);
165 html("</td><td class='right'>"); 165 html("</td><td class='right'>");
166 cgit_print_date(info->author_date, FMT_LONGDATE); 166 cgit_print_date(info->author_date, FMT_LONGDATE);
167 html("</td></tr>\n"); 167 html("</td></tr>\n");
168 html("<tr><th>committer</th><td>"); 168 html("<tr><th>committer</th><td>");
169 html_txt(info->committer); 169 html_txt(info->committer);
170 html(" "); 170 html(" ");
171 html_txt(info->committer_email); 171 html_txt(info->committer_email);
172 html("</td><td class='right'>"); 172 html("</td><td class='right'>");
173 cgit_print_date(info->committer_date, FMT_LONGDATE); 173 cgit_print_date(info->committer_date, FMT_LONGDATE);
174 html("</td></tr>\n"); 174 html("</td></tr>\n");
175 html("<tr><th>tree</th><td colspan='2' class='sha1'>"); 175 html("<tr><th>tree</th><td colspan='2' class='sha1'>");
176 tmp = xstrdup(hex); 176 tmp = xstrdup(hex);
177 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL, 177 cgit_tree_link(sha1_to_hex(commit->tree->object.sha1), NULL, NULL,
178 ctx.qry.head, tmp, NULL); 178 ctx.qry.head, tmp, NULL);
179 html("</td></tr>\n"); 179 html("</td></tr>\n");
180 for (p = commit->parents; p ; p = p->next) { 180 for (p = commit->parents; p ; p = p->next) {
181 parent = lookup_commit_reference(p->item->object.sha1); 181 parent = lookup_commit_reference(p->item->object.sha1);
182 if (!parent) { 182 if (!parent) {
183 html("<tr><td colspan='3'>"); 183 html("<tr><td colspan='3'>");
184 cgit_print_error("Error reading parent commit"); 184 cgit_print_error("Error reading parent commit");
185 html("</td></tr>"); 185 html("</td></tr>");
186 continue; 186 continue;
187 } 187 }
188 html("<tr><th>parent</th>" 188 html("<tr><th>parent</th>"
189 "<td colspan='2' class='sha1'>"); 189 "<td colspan='2' class='sha1'>");
190 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL, 190 cgit_commit_link(sha1_to_hex(p->item->object.sha1), NULL, NULL,
191 ctx.qry.head, sha1_to_hex(p->item->object.sha1)); 191 ctx.qry.head, sha1_to_hex(p->item->object.sha1));
192 html(" ("); 192 html(" (");
193 cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex, 193 cgit_diff_link("diff", NULL, NULL, ctx.qry.head, hex,
194 sha1_to_hex(p->item->object.sha1), NULL); 194 sha1_to_hex(p->item->object.sha1), NULL);
195 html(")</td></tr>"); 195 html(")</td></tr>");
196 } 196 }
197 if (cgit_repo->snapshots) { 197 if (ctx.repo->snapshots) {
198 html("<tr><th>download</th><td colspan='2' class='sha1'>"); 198 html("<tr><th>download</th><td colspan='2' class='sha1'>");
199 cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head, 199 cgit_print_snapshot_links(ctx.qry.repo, ctx.qry.head,
200 hex, cgit_repo->snapshots); 200 hex, ctx.repo->snapshots);
201 html("</td></tr>"); 201 html("</td></tr>");
202 } 202 }
203 html("</table>\n"); 203 html("</table>\n");
204 html("<div class='commit-subject'>"); 204 html("<div class='commit-subject'>");
205 html_txt(info->subject); 205 html_txt(info->subject);
206 html("</div>"); 206 html("</div>");
207 html("<div class='commit-msg'>"); 207 html("<div class='commit-msg'>");
208 html_txt(info->msg); 208 html_txt(info->msg);
209 html("</div>"); 209 html("</div>");
210 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) { 210 if (!(commit->parents && commit->parents->next && commit->parents->next->next)) {
211 html("<div class='diffstat-header'>Diffstat</div>"); 211 html("<div class='diffstat-header'>Diffstat</div>");
212 html("<table summary='diffstat' class='diffstat'>"); 212 html("<table summary='diffstat' class='diffstat'>");
213 max_changes = 0; 213 max_changes = 0;
214 cgit_diff_commit(commit, inspect_filepair); 214 cgit_diff_commit(commit, inspect_filepair);
215 for(i = 0; i<files; i++) 215 for(i = 0; i<files; i++)
216 print_fileinfo(&items[i]); 216 print_fileinfo(&items[i]);
217 html("</table>"); 217 html("</table>");
218 html("<div class='diffstat-summary'>"); 218 html("<div class='diffstat-summary'>");
219 htmlf("%d files changed, %d insertions, %d deletions (", 219 htmlf("%d files changed, %d insertions, %d deletions (",
220 files, total_adds, total_rems); 220 files, total_adds, total_rems);
221 cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex, 221 cgit_diff_link("show diff", NULL, NULL, ctx.qry.head, hex,
222 NULL, NULL); 222 NULL, NULL);
223 html(")</div>"); 223 html(")</div>");
224 } 224 }
225 cgit_free_commitinfo(info); 225 cgit_free_commitinfo(info);
226} 226}