Fix support for insteadOf url remapping. Closes: #644278
This commit is contained in:
parent
3c45371115
commit
7d05ca1d6d
2 changed files with 5 additions and 3 deletions
7
Git.hs
7
Git.hs
|
@ -523,13 +523,14 @@ genRemote s repo = gen $ calcloc s
|
|||
| null insteadofs = l
|
||||
| otherwise = replacement ++ drop (length replacement) l
|
||||
where
|
||||
replacement = take (length bestkey - length prefix) bestkey
|
||||
replacement = drop (length "url.") $
|
||||
take (length bestkey - length suffix) bestkey
|
||||
bestkey = fst $ maximumBy longestvalue insteadofs
|
||||
longestvalue (_, a) (_, b) = compare b a
|
||||
insteadofs = filterconfig $ \(k, v) ->
|
||||
endswith prefix k &&
|
||||
endswith suffix k &&
|
||||
startswith v l
|
||||
prefix = ".insteadof"
|
||||
suffix = ".insteadof"
|
||||
-- git remotes can be written scp style -- [user@]host:dir
|
||||
scpstyle v = ":" `isInfixOf` v && not ("//" `isInfixOf` v)
|
||||
scptourl v = "ssh://" ++ host ++ slash dir
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue