From f2590012aa793602930b4ce12d5d075de84ce9d3 Mon Sep 17 00:00:00 2001 From: Tom Wallace Date: Tue, 6 Nov 2018 11:09:54 -0800 Subject: [PATCH] Updated the git command for getting branch name. Previous code was sometimes getting the tag name instead of the branch name. --- index.js | 2 +- test/_env.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fb36e7a..f73255a 100644 --- a/index.js +++ b/index.js @@ -58,7 +58,7 @@ function loadConfig () { function getEnvIdFromBranch () { try { - let branch = sh.exec('git name-rev HEAD --name-only').stdout + let branch = sh.exec('git rev-parse --abbrev-ref HEAD').stdout.replace(/\n/g, '') branch = _.last(_.split(branch, '/')) diff --git a/test/_env.js b/test/_env.js index 95ea5ab..4993f42 100644 --- a/test/_env.js +++ b/test/_env.js @@ -4,7 +4,7 @@ const _ = require('lodash') const sh = require('shelljs') module.exports = function (regex) { - var env = sh.exec('git name-rev HEAD --name-only').stdout + var env = sh.exec('git rev-parse --abbrev-ref HEAD').stdout.replace(/\n/g, '') env = _.last(_.split(env, '/'))