Windows: Fix handling of absolute unix-style git repository paths.

Note that on Windows a remote with a path like /home/foo/bar
is interpreted by git as being some screwy relative path (relative to what
exactly seems ill-defined -- it seemed relative to C:\Program Files\Git\ in
my tests!) So no attempt has been made to handle such a path sanely, just not
to crash when encountering it.

Note that "C:\\foo" </> "/home/foo/bar" yields /home/foo/bar even though
that is not absolute! I don't know what to make of all this,
except that I will be very happy when this crock of **** vanishes from
the face of the earth.
This commit is contained in:
Joey Hess 2014-02-08 15:31:03 -04:00
parent f068f4e579
commit c95d0cf7a8
6 changed files with 28 additions and 5 deletions

View file

@ -32,7 +32,7 @@ gitCommandLine params r@(Repo { location = l@(Local _ _ ) }) =
#ifdef mingw32_HOST_OS
-- despite running on windows, msysgit wants a unix-formatted path
gitpath s
| isAbsolute s = "/" ++ dropDrive (toInternalGitPath s)
| absoluteGitPath s = "/" ++ dropDrive (toInternalGitPath s)
| otherwise = s
#else
gitpath = id