From ab1c7aeda0359fb174e4dbfdb7e117cc029eb329 Mon Sep 17 00:00:00 2001 From: Gerard Escalante Date: Tue, 11 Feb 2014 11:10:34 +0900 Subject: Windows compat fixes Changed usage of '/' as root dir. Stopped tests from wiping out environment. --- lib/detectLocalGit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/detectLocalGit.js') diff --git a/lib/detectLocalGit.js b/lib/detectLocalGit.js index 3d381db..302cd44 100644 --- a/lib/detectLocalGit.js +++ b/lib/detectLocalGit.js @@ -5,7 +5,7 @@ var REGEX_BRANCH = /^ref: refs\/heads\/(\w+)$/; module.exports = function detectLocalGit(knownCommit, knownBranch) { var dir = process.cwd(), gitDir; - while ('/' !== dir) { + while (path.resolve('/') !== dir) { gitDir = path.join(dir, '.git'); var existsSync = fs.existsSync || path.existsSync; if (existsSync(path.join(gitDir, 'HEAD'))) @@ -14,7 +14,7 @@ module.exports = function detectLocalGit(knownCommit, knownBranch) { dir = path.dirname(dir); } - if ('/' === dir) + if (path.resolve('/') === dir) return; var head = fs.readFileSync(path.join(dir, '.git', 'HEAD'), 'utf-8').trim(); -- cgit v1.2.3