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

Commit

Permalink
overview: show git branch
Browse files Browse the repository at this point in the history
  • Loading branch information
d-xo committed Feb 10, 2020
1 parent cba5127 commit aa14e42
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
12 changes: 12 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ const getKlabHEAD = () => {
});
}

const getProjectBranch = () => {
let branch = "";

if(testPath('.git')) {
branch = execSync(`git rev-parse --abbrev-ref HEAD`, {
encoding: 'utf8'
}).trim();
}

return branch
}

const getProjectHEAD = () => {
var project_HEAD = "";

Expand Down
4 changes: 3 additions & 1 deletion libexec/klab-report
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
getBuildId,
getKlabHEAD,
getProjectHEAD
getProjectBranch
} = require("../lib/util.js")
const fs = require("fs");
const KLAB_OUT = process.env.KLAB_OUT || "out";
Expand Down Expand Up @@ -444,7 +445,8 @@ const json_report = {
[build_hash]: {
date: new Date(),
proofs,
git: project_HEAD
git: project_HEAD,
branch: getProjectBranch()
},
url: config.url,
name: config.name
Expand Down
2 changes: 1 addition & 1 deletion resources/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ loadJSON(json => {
h(["div", 'class="proofinfo"'])([
h(["div", 'class="link"'])([
h(['a', 'class="build-hash"', `href="${o.hash}"`])(o.hash),
h(['span', 'class="proj-hash"'])(`proj: ${o.git}`),
h(['span', 'class="git-rev"'])(`rev: ${o.git.substring(0,6)}${o.branch ? ` (${o.branch})` : ''}`),
h(['div', 'class="info"'])([
date(o.date),
h(['span', 'class="running"'])(running ? 'running (' + skip.length + ')' : '')
Expand Down
2 changes: 1 addition & 1 deletion resources/overview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ a {
}
}

.proj-hash {
.git-rev {
display: block;
font-size: 0.7em;
}
Expand Down

0 comments on commit aa14e42

Please sign in to comment.