swh:1:snp:3af1a03cd091600016317ad7197cfc7dfd1319c7
Tip revision: d12c8f7bb20874d69c4d342cb88bb7264b40b759 authored by Andreas Stuhlmüller on 31 March 2016, 21:52:18 UTC
0.6.2
0.6.2
Tip revision: d12c8f7
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'))
};