瀏覽代碼

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

main
Eric Amodio 8 年之前
父節點
當前提交
d70a47201c
共有 1 個檔案被更改,包括 4 行新增1 行删除
  1. +4
    -1
      src/git.ts

+ 4
- 1
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) {

Loading…
取消
儲存