Skip to content

Commit

Permalink
fix: improve grep to match exactly what we wanted
Browse files Browse the repository at this point in the history
  • Loading branch information
DaRaFF committed Feb 24, 2020
1 parent a76315e commit cd58d2c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/shell/git-has-maintenance-branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cd58d2c

Please sign in to comment.