work around msysgit very strange behavior on ./ or .\ at start of path
Seems that verify_path() rejects such a path on Windows, but I cannot see why. Git bug?
This commit is contained in:
parent
c077cee44a
commit
c717905d15
1 changed files with 12 additions and 3 deletions
|
@ -45,15 +45,24 @@ asTopFilePath :: FilePath -> TopFilePath
|
||||||
asTopFilePath file = TopFilePath file
|
asTopFilePath file = TopFilePath file
|
||||||
|
|
||||||
{- Git may use a different representation of a path when storing
|
{- Git may use a different representation of a path when storing
|
||||||
- it internally. For example, on Windows, git uses '/' to separate paths
|
- it internally.
|
||||||
- stored in the repository, despite Windows using '\' -}
|
-
|
||||||
|
- On Windows, git uses '/' to separate paths stored in the repository,
|
||||||
|
- despite Windows using '\'. Also, git on windows dislikes paths starting
|
||||||
|
- with "./" or ".\".
|
||||||
|
-
|
||||||
|
-}
|
||||||
type InternalGitPath = String
|
type InternalGitPath = String
|
||||||
|
|
||||||
toInternalGitPath :: FilePath -> InternalGitPath
|
toInternalGitPath :: FilePath -> InternalGitPath
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
toInternalGitPath = id
|
toInternalGitPath = id
|
||||||
#else
|
#else
|
||||||
toInternalGitPath = replace "\\" "/"
|
toInternalGitPath p =
|
||||||
|
let p' = replace "\\" "/" p
|
||||||
|
in if "./" `isPrefixOf` p'
|
||||||
|
then dropWhile (== '/') (drop 1 p')
|
||||||
|
else p'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fromInternalGitPath :: InternalGitPath -> FilePath
|
fromInternalGitPath :: InternalGitPath -> FilePath
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue