swh:1:snp:3af1a03cd091600016317ad7197cfc7dfd1319c7
Tip revision: daabd60361f72eef53f69005751facce34c7f916 authored by null-a on 18 April 2019, 13:04:24 UTC
StudentT Tweaks (#931)
StudentT Tweaks (#931)
Tip revision: daabd60
git.js
'use strict';
var execSync = require('child_process').execSync;
function git(cmd) {
return function(dir) {
var options = { cwd: dir, stdio: [] };
return execSync('git ' + cmd, options).toString().trim();
};
}
function catchAll(fn) {
return function(arg) {
try {
return fn(arg);
} catch (e) {
return '';
}
};
}
module.exports = {
short: catchAll(git('rev-parse --short HEAD')),
branch: catchAll(git('rev-parse --abbrev-ref HEAD'))
};