From d70a47201c77d33fc50729de842745854d913a5f Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Wed, 14 Sep 2016 02:29:22 -0400 Subject: [PATCH] Fixes #4 - Absolute paths fail on Windows due to backslash --- src/git.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/git.ts b/src/git.ts index 29856d4..9d86729 100644 --- a/src/git.ts +++ b/src/git.ts @@ -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) {