From 57ea1aa2a5eab7f6aba702b3366fe4dcc72124f6 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:01 +0000 Subject: ui-shared: remove "format" from cgit_print_age() We never use any format other than FMT_SHORTDATE, so move that into the function. Signed-off-by: John Keeping --- ui-log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index a4dc707..5f6a69c 100644 --- a/ui-log.c +++ b/ui-log.c @@ -204,7 +204,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } else { html(""); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(commit->date, TM_WEEK * 2); html(""); } @@ -244,7 +244,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (revs->graph) { html(""); - cgit_print_age(commit->date, TM_WEEK * 2, FMT_SHORTDATE); + cgit_print_age(commit->date, TM_WEEK * 2); } if (!lines_counted && (ctx.repo->enable_log_filecount || -- cgit v1.2.3 From f2a901d2e1db5217d6890b26c6dc1ec119505d02 Mon Sep 17 00:00:00 2001 From: John Keeping Date: Tue, 19 Jan 2016 19:33:05 +0000 Subject: ui: show ages in the originator's timezone This affects the tooltip showing the full time and the case when a date is sufficiently old to be shown in full rather than as an offset. Signed-off-by: John Keeping --- ui-log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 5f6a69c..0a3938b 100644 --- a/ui-log.c +++ b/ui-log.c @@ -204,7 +204,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) } else { html(""); - cgit_print_age(commit->date, TM_WEEK * 2); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); html(""); } @@ -244,7 +244,7 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (revs->graph) { html(""); - cgit_print_age(commit->date, TM_WEEK * 2); + cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); } if (!lines_counted && (ctx.repo->enable_log_filecount || -- cgit v1.2.3 From 499b23979cd29513df16e4c2acce934932e09f7a Mon Sep 17 00:00:00 2001 From: Tim Nordell Date: Fri, 26 Feb 2016 14:57:30 -0600 Subject: ui-log: Do not always emit decoration span The decoration span does not need to be emited if there aren't any decorations to show. This modification saves slightly on bandwidth. Signed-off-by: Tim Nordell --- ui-log.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 0a3938b..641a5b6 100644 --- a/ui-log.c +++ b/ui-log.c @@ -61,6 +61,8 @@ void show_commit_decorations(struct commit *commit) buf[sizeof(buf) - 1] = 0; deco = get_name_decoration(&commit->object); + if (!deco) + return; html(""); while (deco) { if (starts_with(deco->name, "refs/heads/")) { -- cgit v1.2.3 From 59d8fa1a62e7c19911fdf7ee9ceb0fdf8fa3331c Mon Sep 17 00:00:00 2001 From: Tim Nordell Date: Fri, 26 Feb 2016 14:58:41 -0600 Subject: ui-log: Simplify decoration code The decoration code inside of git returns the decoration type, so utilize this to create the decoration spans. Additionally, use prettify_refname(...) to get the shorter name for the ref. Signed-off-by: Tim Nordell --- ui-log.c | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index 641a5b6..d6d94f6 100644 --- a/ui-log.c +++ b/ui-log.c @@ -65,36 +65,34 @@ void show_commit_decorations(struct commit *commit) return; html(""); 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, - oid_to_hex(&commit->object.oid), - 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, - oid_to_hex(&commit->object.oid), - ctx.qry.vpath); + oid_to_hex(&commit->object.oid), + ctx.qry.vpath); + break; } -next: deco = deco->next; } html(""); -- cgit v1.2.3 From 4fb49864db51affddf37ab2a563b0eb4b33e155d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 29 Jun 2016 09:37:57 +0200 Subject: ui-log: color line changes Signed-off-by: Christian Hesse --- ui-log.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui-log.c') diff --git a/ui-log.c b/ui-log.c index d6d94f6..c97b8e0 100644 --- a/ui-log.c +++ b/ui-log.c @@ -258,7 +258,8 @@ static void print_commit(struct commit *commit, struct rev_info *revs) if (ctx.repo->enable_log_filecount) htmlf("%d", files); if (ctx.repo->enable_log_linecount) - htmlf("-%d/+%d", rem_lines, add_lines); + htmlf("-%d/" + "+%d", rem_lines, add_lines); html("\n"); -- cgit v1.2.3