Skip to content

Commit

Permalink
fixing formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jollyromp committed Jun 19, 2018
1 parent 2828040 commit f322b9a
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,34 +57,34 @@ function loadConfig () {
}

function getEnvIdFromBranch() {
try {
var branch = sh.exec('git status', { silent: true }).stdout;
try {
var branch = sh.exec('git status', { silent: true }).stdout;

if (!branch || _.includes(branch, 'fatal:')) {
return;
}
if (!branch || _.includes(branch, 'fatal:')) {
return;
}

branch = branch.split('\n')[0];
branch = branch.replace(/^#?\s?On branch ((\w|-|_|\/|.)+)/, '$1');
branch = branch.split('\n')[0];
branch = branch.replace(/^#?\s?On branch ((\w|-|_|\/|.)+)/, '$1');

if (config.branchRegex) {
branch = branch.replace(new RegExp(_.trim(config.branchRegex)), '$1');
}
if (config.branchRegex) {
branch = branch.replace(new RegExp(_.trim(config.branchRegex)), '$1');
}

branch = _.trimEnd(_.truncate(branch, {
length: 13,
omission: ''
}), '-');
branch = _.trimEnd(_.truncate(branch, {
length: 13,
omission: ''
}), '-');

var hash = sh.exec('git rev-parse origin/master', { silent: true }).stdout;
hash = hash.substring(0, 5);
var hash = sh.exec('git rev-parse origin/master', { silent: true }).stdout;
hash = hash.substring(0, 5);

return (branch.includes(' ')) ? hash : branch;
}
catch (e) {
console.log('ERR: ', e);
// Do nothing
}
return (branch.includes(' ')) ? hash : branch;
}
catch (e) {
console.log('ERR: ', e);
// Do nothing
}
}

function getEnvId (obj, env) {
Expand Down

0 comments on commit f322b9a

Please sign in to comment.