aboutsummaryrefslogtreecommitdiff
path: root/lib/detectLocalGit.js
diff options
context:
space:
mode:
authorHauke Henningsen <[email protected]>2015-04-15 17:59:11 +0200
committerHauke Henningsen <[email protected]>2015-04-15 17:59:11 +0200
commit05c4f1f374e138f0ed0cab62d55f028841a36fe6 (patch)
treebac89e56b7cced2d8360974b50bd9014e361a9a9 /lib/detectLocalGit.js
parentd5e1372bbd79a9fabbceec9624a220f1a8f75348 (diff)
downloadnode-coveralls-05c4f1f374e138f0ed0cab62d55f028841a36fe6.tar.xz
node-coveralls-05c4f1f374e138f0ed0cab62d55f028841a36fe6.zip
Accept more valid git branch names
According to git-check-ref-format(1), branch naming excludes a number of characters, but various non-word characters are definitely allowed. This modifies the `REGEX_BRANCH` detection to match branch names containing some non-word characters, e.g. `features/foo` or `bar-baz`.
Diffstat (limited to 'lib/detectLocalGit.js')
-rw-r--r--lib/detectLocalGit.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/detectLocalGit.js b/lib/detectLocalGit.js
index 302cd44..bc9b6c4 100644
--- a/lib/detectLocalGit.js
+++ b/lib/detectLocalGit.js
@@ -1,7 +1,8 @@
var fs = require('fs');
var path = require('path');
-var REGEX_BRANCH = /^ref: refs\/heads\/(\w+)$/;
+// branch naming only has a few excluded characters, see git-check-ref-format(1)
+var REGEX_BRANCH = /^ref: refs\/heads\/([^?*\[\\~^:]+)$/;
module.exports = function detectLocalGit(knownCommit, knownBranch) {
var dir = process.cwd(), gitDir;