in createmobilespec/createmobilespec.js [310:329]
function getBranchName(moduleName) {
var isConfigFatal = shelljs.config.fatal;
shelljs.config.fatal = false;
cdInto(moduleName);
try {
// output should look like: refs/head/master
var gitOutput = executeShellCommand("git symbolic-ref HEAD").output;
shelljs.config.fatal = isConfigFatal;
var match = /refs\/heads\/(.*)/.exec(gitOutput);
if (!match) {
if (gitOutput.indexOf("is not a symbolic ref") > -1) {
return "detached from HEAD";
}
throw new Error('Could not parse branch name from: ' + gitOutput + '(in module ' + moduleName + ')');
}
return match[1];
} finally {
cdOutOf();
}
}