swh:1:snp:3af1a03cd091600016317ad7197cfc7dfd1319c7
Tip revision: 82a7bc8cdd1d4fd27f8acd6823057757111a5aff authored by Andreas Stuhlmüller on 06 October 2016, 15:29:24 UTC
0.9.3
0.9.3
Tip revision: 82a7bc8
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'))
};