aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristophe Porteneuve <[email protected]>2013-11-08 20:02:29 +0100
committerChristophe Porteneuve <[email protected]>2013-11-08 20:02:29 +0100
commitb12c8cf5f0bc11486e2b064a834ee9ff81adb0a3 (patch)
treec9d4c6e350d912883719ae5b4a455111ffeaa079 /lib
parenta49eaa7f533bb7c3338d7864e3d118d43ede861e (diff)
downloadnode-coveralls-b12c8cf5f0bc11486e2b064a834ee9ff81adb0a3.tar.xz
node-coveralls-b12c8cf5f0bc11486e2b064a834ee9ff81adb0a3.zip
Ah, right, ES5 has String#trim(), keep forgetting that…
Diffstat (limited to 'lib')
-rw-r--r--lib/detectLocalGit.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/detectLocalGit.js b/lib/detectLocalGit.js
index 2d0fba0..4fd8d1b 100644
--- a/lib/detectLocalGit.js
+++ b/lib/detectLocalGit.js
@@ -16,15 +16,11 @@ module.exports = function detectLocalGit(knownCommit, knownBranch) {
if ('/' === dir)
return;
- var head = strip(fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8'));
+ var head = fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8').trim();
var branch = (head.match(REGEX_BRANCH) || [])[1];
if (!branch)
return { git_commit: head };
- var commit = strip(fs.readFileSync(path.join(dir, '.git', 'refs', 'heads', branch), 'utf-8'));
+ var commit = fs.readFileSync(path.join(dir, '.git', 'refs', 'heads', branch), 'utf-8').trim();
return { git_commit: commit, git_branch: branch };
};
-
-function strip(str) {
- return (str || '').replace(/^\s+|\s+$/g, '');
-}