files++;
if (ctx.repo->enable_log_linecount)
- cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size,
+ cgit_diff_files(&pair->one->oid, &pair->two->oid, &old_size,
&new_size, &binary, 0, ctx.qry.ignorews,
count_lines);
}
buf[sizeof(buf) - 1] = 0;
deco = get_name_decoration(&commit->object);
+ if (!deco)
+ return;
html("<span class='decoration'>");
while (deco) {
- if (starts_with(deco->name, "refs/heads/")) {
- strncpy(buf, deco->name + 11, sizeof(buf) - 1);
+ strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1);
+ switch(deco->type) {
+ case DECORATION_NONE:
+ /* If the git-core doesn't recognize it,
+ * don't display anything. */
+ break;
+ case DECORATION_REF_LOCAL:
cgit_log_link(buf, NULL, "branch-deco", buf, NULL,
- ctx.qry.vpath, 0, NULL, NULL,
- ctx.qry.showmsg, 0);
- }
- else if (starts_with(deco->name, "tag: refs/tags/")) {
- strncpy(buf, deco->name + 15, sizeof(buf) - 1);
- cgit_tag_link(buf, NULL, "tag-deco", buf);
- }
- else if (starts_with(deco->name, "refs/tags/")) {
- strncpy(buf, deco->name + 10, sizeof(buf) - 1);
+ ctx.qry.vpath, 0, NULL, NULL,
+ ctx.qry.showmsg, 0);
+ break;
+ case DECORATION_REF_TAG:
cgit_tag_link(buf, NULL, "tag-deco", buf);
- }
- else if (starts_with(deco->name, "refs/remotes/")) {
+ break;
+ case DECORATION_REF_REMOTE:
if (!ctx.repo->enable_remote_branches)
- goto next;
- strncpy(buf, deco->name + 13, sizeof(buf) - 1);
+ break;
cgit_log_link(buf, NULL, "remote-deco", NULL,
- sha1_to_hex(commit->object.sha1),
- ctx.qry.vpath, 0, NULL, NULL,
- ctx.qry.showmsg, 0);
- }
- else {
- strncpy(buf, deco->name, sizeof(buf) - 1);
+ oid_to_hex(&commit->object.oid),
+ ctx.qry.vpath, 0, NULL, NULL,
+ ctx.qry.showmsg, 0);
+ break;
+ default:
cgit_commit_link(buf, NULL, "deco", ctx.qry.head,
- sha1_to_hex(commit->object.sha1),
- ctx.qry.vpath);
+ oid_to_hex(&commit->object.oid),
+ ctx.qry.vpath);
+ break;
}
-next:
deco = deco->next;
}
html("</span>");
struct commit_list *parents = commit->parents;
struct commit *parent;
int found = 0, saved_fmt;
- unsigned saved_flags = revs->diffopt.flags;
-
+ struct diff_flags saved_flags = revs->diffopt.flags;
/* Always show if we're not in "follow" mode with a single file. */
if (!ctx.qry.follow)
/* When we get here we have precisely one parent. */
parent = parents->item;
- parse_commit(parent);
+ /* If we can't parse the commit, let print_commit() report an error. */
+ if (parse_commit(parent))
+ return 1;
files = 0;
add_lines = 0;
rem_lines = 0;
- DIFF_OPT_SET(&revs->diffopt, RECURSIVE);
- diff_tree_sha1(parent->tree->object.sha1,
- commit->tree->object.sha1,
- "", &revs->diffopt);
+ revs->diffopt.flags.recursive = 1;
+ diff_tree_oid(&parent->tree->object.oid,
+ &commit->tree->object.oid,
+ "", &revs->diffopt);
diffcore_std(&revs->diffopt);
found = !diff_queue_is_empty();
}
else {
html("<td>");
- cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
+ cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2);
html("</td>");
}
}
}
cgit_commit_link(info->subject, NULL, NULL, ctx.qry.head,
- sha1_to_hex(commit->object.sha1), ctx.qry.vpath);
+ oid_to_hex(&commit->object.oid), ctx.qry.vpath);
show_commit_decorations(commit);
html("</td><td>");
cgit_open_filter(ctx.repo->email_filter, info->author_email, "log");
if (revs->graph) {
html("</td><td>");
- cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE);
+ cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2);
}
if (!lines_counted && (ctx.repo->enable_log_filecount ||
if (ctx.repo->enable_log_filecount)
htmlf("</td><td>%d", files);
if (ctx.repo->enable_log_linecount)
- htmlf("</td><td>-%d/+%d", rem_lines, add_lines);
+ htmlf("</td><td><span class='deletions'>-%d</span>/"
+ "<span class='insertions'>+%d</span>", rem_lines, add_lines);
html("</td></tr>\n");
- if (revs->graph || ctx.qry.showmsg) { /* Print a second table row */
- html("<tr class='nohover'>");
+ if ((revs->graph && !graph_is_commit_finished(revs->graph))
+ || ctx.qry.showmsg) { /* Print a second table row */
+ html("<tr class='nohover-highlight'>");
if (ctx.qry.showmsg) {
/* Concatenate commit message + notes in msgbuf */
strbuf_addstr(&msgbuf, info->msg);
strbuf_addch(&msgbuf, '\n');
}
- format_display_notes(commit->object.sha1,
+ format_display_notes(&commit->object.oid,
&msgbuf, PAGE_ENCODING, 0);
strbuf_addch(&msgbuf, '\n');
strbuf_ltrim(&msgbuf);
struct strbuf longref = STRBUF_INIT;
strbuf_addf(&longref, "refs/heads/%s", ref);
- if (get_sha1(longref.buf, oid.hash) == 0) {
+ if (get_oid(longref.buf, &oid) == 0) {
*must_free_result = 1;
return strbuf_detach(&longref, NULL);
}
rev.ignore_missing = 1;
rev.simplify_history = 1;
setup_revisions(rev_argv.argc, rev_argv.argv, &rev, NULL);
- load_ref_decorations(DECORATE_FULL_REFS);
+ load_ref_decorations(NULL, DECORATE_FULL_REFS);
rev.show_decorations = 1;
- rev.grep_filter.regflags |= REG_ICASE;
+ rev.grep_filter.ignore_case = 1;
rev.diffopt.detect_rename = 1;
rev.diffopt.rename_limit = ctx.cfg.renamelimit;