Skip to content
This repository was archived by the owner on Aug 20, 2021. It is now read-only.

Commit 2e76f69

Browse files
committed
overview: show git branch
1 parent cba5127 commit 2e76f69

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

lib/util.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ const getKlabHEAD = () => {
8282
});
8383
}
8484

85+
const getProjectBranch = () => {
86+
let branch = "";
87+
88+
if(testPath('.git')) {
89+
branch = execSync(`git rev-parse --abbrev-ref HEAD`, {
90+
encoding: 'utf8'
91+
}).trim();
92+
}
93+
94+
return branch
95+
}
96+
8597
const getProjectHEAD = () => {
8698
var project_HEAD = "";
8799

@@ -124,5 +136,6 @@ module.exports = {
124136
getBuildId,
125137
getKlabHEAD,
126138
getProjectHEAD,
139+
getProjectBranch,
127140
getStatus
128141
};

libexec/klab-report

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const {
1515
sha3,
1616
getBuildId,
1717
getKlabHEAD,
18-
getProjectHEAD
18+
getProjectHEAD,
19+
getProjectBranch
1920
} = require("../lib/util.js")
2021
const fs = require("fs");
2122
const KLAB_OUT = process.env.KLAB_OUT || "out";
@@ -444,7 +445,8 @@ const json_report = {
444445
[build_hash]: {
445446
date: new Date(),
446447
proofs,
447-
git: project_HEAD
448+
git: project_HEAD,
449+
branch: getProjectBranch()
448450
},
449451
url: config.url,
450452
name: config.name

resources/overview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ loadJSON(json => {
142142
h(["div", 'class="proofinfo"'])([
143143
h(["div", 'class="link"'])([
144144
h(['a', 'class="build-hash"', `href="${o.hash}"`])(o.hash),
145-
h(['span', 'class="proj-hash"'])(`proj: ${o.git}`),
145+
h(['span', 'class="git-rev"'])(`rev: ${o.git.substring(0,8)}${o.branch ? ` (${o.branch})` : ''}`),
146146
h(['div', 'class="info"'])([
147147
date(o.date),
148148
h(['span', 'class="running"'])(running ? 'running (' + skip.length + ')' : '')

resources/overview.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ a {
6262
}
6363
}
6464

65-
.proj-hash {
65+
.git-rev {
6666
display: block;
6767
font-size: 0.7em;
6868
}

0 commit comments

Comments
 (0)