diff options
author | Joey Hess <joeyh@joeyh.name> | 2023-08-14 12:06:32 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2023-08-14 12:12:52 -0400 |
commit | edf83982be214f3c839fab9b659f645de53a9100 (patch) | |
tree | bef06cb750379c6d7942fc13b13fcb328201354c /Git/Remote.hs | |
parent | f0cd3a2a3758ddcd2f0900c16bdc1fb80bbd6e92 (diff) | |
download | git-repair-edf83982be214f3c839fab9b659f645de53a9100.tar.gz |
merge from git-annex
Support building with unix-compat 0.7
Diffstat (limited to 'Git/Remote.hs')
-rw-r--r-- | Git/Remote.hs | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Git/Remote.hs b/Git/Remote.hs index 80accca..9cdaad6 100644 --- a/Git/Remote.hs +++ b/Git/Remote.hs @@ -43,7 +43,7 @@ remoteKeyToRemoteName (ConfigKey k) {- Construct a legal git remote name out of an arbitrary input string. - - There seems to be no formal definition of this in the git source, - - just some ad-hoc checks, and some other things that fail with certian + - just some ad-hoc checks, and some other things that fail with certain - types of names (like ones starting with '-'). -} makeLegalName :: String -> RemoteName @@ -63,7 +63,7 @@ makeLegalName s = case filter legal $ replace "/" "_" s of legal c = isAlphaNum c data RemoteLocation = RemoteUrl String | RemotePath FilePath - deriving (Eq) + deriving (Eq, Show) remoteLocationIsUrl :: RemoteLocation -> Bool remoteLocationIsUrl (RemoteUrl _) = True @@ -75,16 +75,18 @@ remoteLocationIsSshUrl _ = False {- Determines if a given remote location is an url, or a local - path. Takes the repository's insteadOf configuration into account. -} -parseRemoteLocation :: String -> Repo -> RemoteLocation -parseRemoteLocation s repo = ret $ calcloc s +parseRemoteLocation :: String -> Bool -> Repo -> RemoteLocation +parseRemoteLocation s knownurl repo = go where - ret v + s' = calcloc s + go #ifdef mingw32_HOST_OS - | dosstyle v = RemotePath (dospath v) + | dosstyle s' = RemotePath (dospath s') #endif - | scpstyle v = RemoteUrl (scptourl v) - | urlstyle v = RemoteUrl v - | otherwise = RemotePath v + | scpstyle s' = RemoteUrl (scptourl s') + | urlstyle s' = RemoteUrl s' + | knownurl && s' == s = RemoteUrl s' + | otherwise = RemotePath s' -- insteadof config can rewrite remote location calcloc l | null insteadofs = l |