[PATCH 1/1] ui-log: highlight annotated tags in different color
Christian Hesse
list at eworm.de
Tue Jun 5 12:47:52 CEST 2018
From: Christian Hesse <mail at eworm.de>
Signed-off-by: Christian Hesse <mail at eworm.de>
---
cgit.css | 8 ++++++++
ui-log.c | 7 ++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/cgit.css b/cgit.css
index 217a05a..05c4530 100644
--- a/cgit.css
+++ b/cgit.css
@@ -685,6 +685,14 @@ div#cgit a.tag-deco {
border: solid 1px #777700;
}
+div#cgit a.tag-annotated-deco {
+ color: #000;
+ margin: 0px 0.5em;
+ padding: 0px 0.25em;
+ background-color: #ffcc88;
+ border: solid 1px #777700;
+}
+
div#cgit a.remote-deco {
color: #000;
margin: 0px 0.5em;
diff --git a/ui-log.c b/ui-log.c
index 8e36fba..b8344a8 100644
--- a/ui-log.c
+++ b/ui-log.c
@@ -56,8 +56,10 @@ static void inspect_files(struct diff_filepair *pair)
void show_commit_decorations(struct commit *commit)
{
+ struct object_id peeled;
const struct name_decoration *deco;
static char buf[1024];
+ int is_annotated;
buf[sizeof(buf) - 1] = 0;
deco = get_name_decoration(&commit->object);
@@ -65,6 +67,7 @@ void show_commit_decorations(struct commit *commit)
return;
html("<span class='decoration'>");
while (deco) {
+ is_annotated = 0;
strncpy(buf, prettify_refname(deco->name), sizeof(buf) - 1);
switch(deco->type) {
case DECORATION_NONE:
@@ -77,7 +80,9 @@ void show_commit_decorations(struct commit *commit)
ctx.qry.showmsg, 0);
break;
case DECORATION_REF_TAG:
- cgit_tag_link(buf, NULL, "tag-deco", buf);
+ if (!peel_ref(deco->name, &peeled))
+ is_annotated = !oidcmp(&commit->object.oid, &peeled);
+ cgit_tag_link(buf, NULL, is_annotated ? "tag-annotated-deco" : "tag-deco", buf);
break;
case DECORATION_REF_REMOTE:
if (!ctx.repo->enable_remote_branches)
More information about the CGit
mailing list