Skip to content

Commit

Permalink
fix: fix regex for parsing git branch
Browse files Browse the repository at this point in the history
In certain cases the trailing `)` produced by `git show -s --pretty=%d HEAD` was kept in the branch name.
  • Loading branch information
pvdlg committed Apr 30, 2018
1 parent 5a75d02 commit 4324504
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function branch() {
try {
const branch = execa
.sync('git', ['show', '-s', '--pretty=%d', 'HEAD'])
.stdout.match(/\(?(.*)\)?/)[1]
.stdout.replace(/^\(|\)$/g, '')
.split(', ')
.find(branch => branch.startsWith('origin/'));

Expand Down

0 comments on commit 4324504

Please sign in to comment.