Fixes #4 - Absolute paths fail on Windows due to backslash

This commit is contained in:
Eric Amodio
2016-09-14 02:29:22 -04:00
parent e0cf335811
commit d70a47201c

View File

@@ -16,7 +16,10 @@ function gitCommand(cwd: string, ...args) {
export default class Git {
static normalizePath(fileName: string, repoPath: string) {
return (isAbsolute(fileName) ? relative(repoPath, fileName) : fileName).replace(/\\/g, '/');
if (isAbsolute(fileName) && fileName.startsWith(repoPath)) {
fileName = relative(repoPath, fileName);
}
return fileName.replace(/\\/g, '/');
}
static repoPath(cwd: string) {