From cd58d2cbd7cede3207e87d80b475f2d614a282de Mon Sep 17 00:00:00 2001 From: Ralph Meier Date: Mon, 24 Feb 2020 10:06:57 +0100 Subject: [PATCH] fix: improve grep to match exactly what we wanted --- lib/shell/git-has-maintenance-branch.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/shell/git-has-maintenance-branch.js b/lib/shell/git-has-maintenance-branch.js index 3d4606c..fb92606 100644 --- a/lib/shell/git-has-maintenance-branch.js +++ b/lib/shell/git-has-maintenance-branch.js @@ -3,7 +3,14 @@ module.exports = function (dep) { return function (argv) { logBgYellow(`Check if the branch ${argv.releaseBranchName} already exists`) try { - exec(`git branch -a | grep -w "${argv.releaseBranchName}"`) + // match + // "* release-2020-02" + // " release-2020-02" + // " remotes/origin/release-2020-02" + // not match + // "upstream-release-2020-02" + // "remotes/origin/upstream-release-2020-02" + exec(`git branch -a | egrep -i "(\*\s|\s\s|/)+${argv.releaseBranchName}$"`) // eslint-disable-line } catch (e) { logYellow(`The branch '${argv.releaseBranchName}' does not exist`) return