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

overview: show git branch #346

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 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 Expand Up @@ -124,5 +136,6 @@ module.exports = {
getBuildId,
getKlabHEAD,
getProjectHEAD,
getProjectBranch,
getStatus
};
6 changes: 4 additions & 2 deletions libexec/klab-report
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const {
sha3,
getBuildId,
getKlabHEAD,
getProjectHEAD
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like we could start adding these things to a git key, rather than having multiple keys. git.head = ...; git.branch = ..., maybe git.url in the future.

Copy link
Contributor Author

@d-xo d-xo Feb 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good idea, but I wonder if we will run into issues with backwards compatibility with old reports?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where would this break? You'd need to change in overview.js as well ofc. Are there other coupling points?

Anyway, this doesn't have to hold back this PR.

},
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,8)}${o.branch ? ` (${o.branch})` : ''}`),
asymmetric marked this conversation as resolved.
Show resolved Hide resolved
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