feat(third_party/cgit): Render timestamps in dottime

Using the DATE_DOTTIME format support in git.
This commit is contained in:
Vincent Ambo 2020-01-12 03:12:34 +00:00
parent 8d8932840e
commit c2a797ed8b
4 changed files with 8 additions and 8 deletions

View file

@ -26,14 +26,14 @@ static char *emit_suspect_detail(struct blame_origin *suspect)
strbuf_addf(&detail, " %s", info->author_email); strbuf_addf(&detail, " %s", info->author_email);
strbuf_addf(&detail, " %s\n", strbuf_addf(&detail, " %s\n",
show_date(info->author_date, info->author_tz, show_date(info->author_date, info->author_tz,
cgit_date_mode(DATE_ISO8601))); cgit_date_mode(DATE_DOTTIME)));
strbuf_addf(&detail, "committer %s", info->committer); strbuf_addf(&detail, "committer %s", info->committer);
if (!ctx.cfg.noplainemail) if (!ctx.cfg.noplainemail)
strbuf_addf(&detail, " %s", info->committer_email); strbuf_addf(&detail, " %s", info->committer_email);
strbuf_addf(&detail, " %s\n\n", strbuf_addf(&detail, " %s\n\n",
show_date(info->committer_date, info->committer_tz, show_date(info->committer_date, info->committer_tz,
cgit_date_mode(DATE_ISO8601))); cgit_date_mode(DATE_DOTTIME)));
strbuf_addstr(&detail, info->subject); strbuf_addstr(&detail, info->subject);

View file

@ -56,7 +56,7 @@ void cgit_print_commit(char *hex, const char *prefix)
cgit_close_filter(ctx.repo->email_filter); cgit_close_filter(ctx.repo->email_filter);
html("</td><td class='right'>"); html("</td><td class='right'>");
html_txt(show_date(info->author_date, info->author_tz, html_txt(show_date(info->author_date, info->author_tz,
cgit_date_mode(DATE_ISO8601))); cgit_date_mode(DATE_DOTTIME)));
html("</td></tr>\n"); html("</td></tr>\n");
html("<tr><th>committer</th><td>"); html("<tr><th>committer</th><td>");
cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit"); cgit_open_filter(ctx.repo->email_filter, info->committer_email, "commit");
@ -68,7 +68,7 @@ void cgit_print_commit(char *hex, const char *prefix)
cgit_close_filter(ctx.repo->email_filter); cgit_close_filter(ctx.repo->email_filter);
html("</td><td class='right'>"); html("</td><td class='right'>");
html_txt(show_date(info->committer_date, info->committer_tz, html_txt(show_date(info->committer_date, info->committer_tz,
cgit_date_mode(DATE_ISO8601))); cgit_date_mode(DATE_DOTTIME)));
html("</td></tr>\n"); html("</td></tr>\n");
html("<tr><th>commit</th><td colspan='2' class='sha1'>"); html("<tr><th>commit</th><td colspan='2' class='sha1'>");
tmp = oid_to_hex(&commit->object.oid); tmp = oid_to_hex(&commit->object.oid);

View file

@ -670,7 +670,7 @@ static void print_rel_date(time_t t, int tz, double value,
const char *class, const char *suffix) const char *class, const char *suffix)
{ {
htmlf("<span class='%s' title='", class); htmlf("<span class='%s' title='", class);
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); html_attr(show_date(t, tz, cgit_date_mode(DATE_DOTTIME)));
htmlf("'>%.0f %s</span>", value, suffix); htmlf("'>%.0f %s</span>", value, suffix);
} }
@ -687,7 +687,7 @@ void cgit_print_age(time_t t, int tz, time_t max_relative)
if (secs > max_relative && max_relative >= 0) { if (secs > max_relative && max_relative >= 0) {
html("<span title='"); html("<span title='");
html_attr(show_date(t, tz, cgit_date_mode(DATE_ISO8601))); html_attr(show_date(t, tz, cgit_date_mode(DATE_DOTTIME)));
html("'>"); html("'>");
html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT))); html_txt(show_date(t, tz, cgit_date_mode(DATE_SHORT)));
html("</span>"); html("</span>");
@ -833,7 +833,7 @@ void cgit_print_docend(void)
else { else {
htmlf("<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit %s</a> " htmlf("<div class='footer'>generated by <a href='https://git.zx2c4.com/cgit/about/'>cgit %s</a> "
"(<a href='https://git-scm.com/'>git %s</a>) at ", cgit_version, git_version_string); "(<a href='https://git-scm.com/'>git %s</a>) at ", cgit_version, git_version_string);
html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_ISO8601))); html_txt(show_date(time(NULL), 0, cgit_date_mode(DATE_DOTTIME)));
html("</div>\n"); html("</div>\n");
} }
html("</div> <!-- id=cgit -->\n"); html("</div> <!-- id=cgit -->\n");

View file

@ -77,7 +77,7 @@ void cgit_print_tag(char *revname)
if (info->tagger_date > 0) { if (info->tagger_date > 0) {
html("<tr><td>tag date</td><td>"); html("<tr><td>tag date</td><td>");
html_txt(show_date(info->tagger_date, info->tagger_tz, html_txt(show_date(info->tagger_date, info->tagger_tz,
cgit_date_mode(DATE_ISO8601))); cgit_date_mode(DATE_DOTTIME)));
html("</td></tr>\n"); html("</td></tr>\n");
} }
if (info->tagger) { if (info->tagger) {