diff options
context:
space:
mode:
authorBryce Kwon <bryce@brycekwon.com>
committerBryce Kwon <bryce@brycekwon.com>
commit
parent
tree
download
Name the tagged object under its full id
Diffstat (limited to 'source/ui-shared.c')
-rw-r--r--source/ui-shared.c14
1 file changed, 9 insertions, 5 deletions
diff --git a/source/ui-shared.c b/source/ui-shared.c
index 2f0843c..bb786a6 100644
--- a/source/ui-shared.c
+++ b/source/ui-shared.c
@@ -1020,16 +1020,21 @@ void cgit_stats_link(const char *name, const char *title, const char *class,
reporevlink("stats", name, title, class, head, NULL, path);
}
-void cgit_object_link(struct object *obj)
+void cgit_object_link(struct object *obj, int full)
{
const char *page;
char *shortrev, *fullrev, *name;
fullrev = oid_to_hex(&obj->oid);
- shortrev = xstrdup(fullrev);
- shortrev[SHORT_HASH_LEN] = '\0';
+ if (full) {
+ name = cgit_fmt("%s %s", type_name(obj->type), fullrev);
+ } else {
+ shortrev = xstrdup(fullrev);
+ shortrev[SHORT_HASH_LEN] = '\0';
+ name = cgit_fmt("%s %s...", type_name(obj->type), shortrev);
+ }
if (obj->type == OBJ_COMMIT) {
- cgit_commit_link(cgit_fmt("commit %s...", shortrev), NULL, NULL, ctx.qry.head, fullrev, NULL);
+ cgit_commit_link(name, NULL, NULL, ctx.qry.head, fullrev, NULL);
return;
} else if (obj->type == OBJ_TREE)
page = "tree";
@@ -1037,7 +1042,6 @@ void cgit_object_link(struct object *obj)
page = "tag";
else
page = "blob";
- name = cgit_fmt("%s %s...", type_name(obj->type), shortrev);
reporevlink(page, name, NULL, NULL, ctx.qry.head, fullrev, NULL);
}