Fix path standardization on case-sensitive file systems.

This commit is contained in:
joshaber
2015-12-30 12:10:33 -05:00
parent 34ab798362
commit 3af5e8cc18

View File

@@ -194,17 +194,16 @@ export default class GitRepositoryAsync {
workingDirectory = `${workingDirectory}/`
}
const originalPath = _path
if (this.isCaseInsensitive) {
const lowerCasePath = _path.toLowerCase()
_path = _path.toLowerCase()
workingDirectory = workingDirectory.toLowerCase()
if (lowerCasePath.indexOf(workingDirectory) === 0) {
return _path.substring(workingDirectory.length)
} else {
if (lowerCasePath === workingDirectory) {
return ''
}
}
}
if (_path.indexOf(workingDirectory) === 0) {
return originalPath.substring(workingDirectory.length)
} else if (_path === workingDirectory) {
return ''
}
return _path