Fixes issues with paths on Windows

This commit is contained in:
Eric Amodio
2017-03-22 00:50:06 -04:00
parent 97f88489a4
commit 4e3ccd9581
9 changed files with 35 additions and 33 deletions

View File

@@ -132,7 +132,7 @@ export class GitBlameParser {
if (i === 0) {
// Try to get the repoPath from the most recent commit
repoPath = fileName.replace(`/${entry.fileName}`, '');
repoPath = Git.normalizePath(fileName.replace(`/${entry.fileName}`, ''));
relativeFileName = path.relative(repoPath, fileName).replace(/\\/g, '/');
}

View File

@@ -188,7 +188,7 @@ export class GitLogParser {
let recentCommit: GitLogCommit;
if (isRepoPath) {
repoPath = fileNameOrRepoPath;
repoPath = Git.normalizePath(fileNameOrRepoPath);
}
for (let i = 0, len = entries.length; i < len; i++) {
@@ -203,7 +203,7 @@ export class GitLogParser {
}
else {
// Try to get the repoPath from the most recent commit
repoPath = fileNameOrRepoPath.replace(fileNameOrRepoPath.startsWith('/') ? `/${entry.fileName}` : entry.fileName, '');
repoPath = Git.normalizePath(fileNameOrRepoPath.replace(fileNameOrRepoPath.startsWith('/') ? `/${entry.fileName}` : entry.fileName, ''));
relativeFileName = path.relative(repoPath, fileNameOrRepoPath).replace(/\\/g, '/');
}
}

View File

@@ -1,5 +1,5 @@
'use strict';
import { GitStatusFileStatus, GitStatusFile, IGitStatus } from './../git';
import { Git, GitStatusFileStatus, GitStatusFile, IGitStatus } from './../git';
interface IFileStatusEntry {
staged: boolean;
@@ -17,7 +17,7 @@ export class GitStatusParser {
if (!lines.length) return undefined;
const status = {
repoPath: repoPath,
repoPath: Git.normalizePath(repoPath),
state: {
ahead: 0,
behind: 0