From 45e7f2c3884fdd81356a74afae19eefcdc37dce8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 22 Jun 2022 00:02:25 +0300 Subject: feat(3p/cgit): Display depot revisions in log views depot revisions are not recognised by git as a specific type of "decoration" (i.e. fall into `DECORATION_NONE`), which means that cgit skips them by default. Displaying them on code.tvl.fyi would be quite nice, so to work around this we check for the `refs/r/` prefix on skipped decorations and display them (without the `refs/` prefix) on commits. Change-Id: Ia9cece3876db471f93ab787258be527739af046b Reviewed-on: https://cl.tvl.fyi/c/depot/+/5891 Tested-by: BuildkiteCI Reviewed-by: Profpatsch --- third_party/cgit/ui-log.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'third_party/cgit/ui-log.c') diff --git a/third_party/cgit/ui-log.c b/third_party/cgit/ui-log.c index cfa9192b9365..6cd258c1ccf2 100644 --- a/third_party/cgit/ui-log.c +++ b/third_party/cgit/ui-log.c @@ -71,6 +71,16 @@ void show_commit_decorations(struct commit *commit) strlcpy(buf, prettify_refname(deco->name), sizeof(buf)); switch(deco->type) { case DECORATION_NONE: + /* If it is a depot revision, display it, otherwise + * ... */ + if (strncmp("refs/r/", buf, 7) == 0) { + html(" "); + cgit_log_link(/* trim 'refs/' */ buf + 5, + NULL, "rev-deco", buf, NULL, + ctx.qry.vpath, 0, NULL, NULL, + ctx.qry.showmsg, 0); + } + /* If the git-core doesn't recognize it, * don't display anything. */ break; -- cgit 1.4.1