diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-15 19:03:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-15 19:03:25 -0400 |
commit | 80a0be5116ada2c718fa6db0a90100d24660beec (patch) | |
tree | b9981e773f3e4c2410f26df621cc4bbf7d93b243 | |
parent | 7d05ca1d6d01f7e9f8b2acdebac2b656e178a32c (diff) |
further insteadOf fix
-rw-r--r-- | Git.hs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -521,16 +521,17 @@ genRemote s repo = gen $ calcloc s -- insteadof config can rewrite remote location calcloc l | null insteadofs = l - | otherwise = replacement ++ drop (length replacement) l + | otherwise = replacement ++ drop (length bestvalue) l where - replacement = drop (length "url.") $ + replacement = drop (length prefix) $ take (length bestkey - length suffix) bestkey - bestkey = fst $ maximumBy longestvalue insteadofs + (bestkey, bestvalue) = maximumBy longestvalue insteadofs longestvalue (_, a) (_, b) = compare b a insteadofs = filterconfig $ \(k, v) -> + startswith prefix k && endswith suffix k && startswith v l - suffix = ".insteadof" + (prefix, suffix) = ("url." , ".insteadof") -- git remotes can be written scp style -- [user@]host:dir scpstyle v = ":" `isInfixOf` v && not ("//" `isInfixOf` v) scptourl v = "ssh://" ++ host ++ slash dir |