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 <mail@profpatsch.de>
This commit is contained in:
parent
cf91baa938
commit
45e7f2c388
2 changed files with 18 additions and 0 deletions
8
third_party/cgit/cgit.css
vendored
8
third_party/cgit/cgit.css
vendored
|
@ -668,6 +668,13 @@ div#cgit a.branch-deco {
|
||||||
border: solid 1px #007700;
|
border: solid 1px #007700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#cgit a.rev-deco {
|
||||||
|
color: #000;
|
||||||
|
padding: 0px 0.25em;
|
||||||
|
background-color: #eee;
|
||||||
|
border: solid 1px #aaa;
|
||||||
|
}
|
||||||
|
|
||||||
div#cgit a.tag-deco {
|
div#cgit a.tag-deco {
|
||||||
color: #000;
|
color: #000;
|
||||||
padding: 0px 0.25em;
|
padding: 0px 0.25em;
|
||||||
|
@ -700,6 +707,7 @@ div#cgit div.commit-subject a.branch-deco,
|
||||||
div#cgit div.commit-subject a.tag-deco,
|
div#cgit div.commit-subject a.tag-deco,
|
||||||
div#cgit div.commit-subject a.tag-annotated-deco,
|
div#cgit div.commit-subject a.tag-annotated-deco,
|
||||||
div#cgit div.commit-subject a.remote-deco,
|
div#cgit div.commit-subject a.remote-deco,
|
||||||
|
div#cgit div.commit-subject a.rev-deco,
|
||||||
div#cgit div.commit-subject a.deco {
|
div#cgit div.commit-subject a.deco {
|
||||||
font-size: 75%;
|
font-size: 75%;
|
||||||
}
|
}
|
||||||
|
|
10
third_party/cgit/ui-log.c
vendored
10
third_party/cgit/ui-log.c
vendored
|
@ -71,6 +71,16 @@ void show_commit_decorations(struct commit *commit)
|
||||||
strlcpy(buf, prettify_refname(deco->name), sizeof(buf));
|
strlcpy(buf, prettify_refname(deco->name), sizeof(buf));
|
||||||
switch(deco->type) {
|
switch(deco->type) {
|
||||||
case DECORATION_NONE:
|
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,
|
/* If the git-core doesn't recognize it,
|
||||||
* don't display anything. */
|
* don't display anything. */
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue