adeiu, MissingH
Removed dependency on MissingH, instead depending on the split library. After laying groundwork for this since 2015, it was mostly straightforward. Added Utility.Tuple and Utility.Split. Eyeballed System.Path.WildMatch while implementing the same thing. Since MissingH's progress meter display was being used, I re-implemented my own. Bonus: Now progress is displayed for transfers of files of unknown size. This commit was sponsored by Shane-o on Patreon.
This commit is contained in:
parent
6dd806f1ad
commit
a1730cd6af
37 changed files with 230 additions and 101 deletions
|
@ -26,7 +26,6 @@ import qualified Data.ByteString.Lazy.Char8 as L8
|
|||
import qualified Data.Map as M
|
||||
import Data.String
|
||||
import Data.Char
|
||||
import Data.Tuple.Utils
|
||||
import Numeric
|
||||
import System.Posix.Types
|
||||
|
||||
|
@ -38,6 +37,7 @@ import Git.Types
|
|||
import Git.FilePath
|
||||
import qualified Utility.CoProcess as CoProcess
|
||||
import Utility.FileSystemEncoding
|
||||
import Utility.Tuple
|
||||
|
||||
data CatFileHandle = CatFileHandle
|
||||
{ catFileProcess :: CoProcess.CoProcessHandle
|
||||
|
|
|
@ -94,7 +94,7 @@ fromUrl url
|
|||
|
||||
fromUrlStrict :: String -> IO Repo
|
||||
fromUrlStrict url
|
||||
| startswith "file://" url = fromAbsPath $ unEscapeString $ uriPath u
|
||||
| "file://" `isPrefixOf` url = fromAbsPath $ unEscapeString $ uriPath u
|
||||
| otherwise = pure $ newFrom $ Url u
|
||||
where
|
||||
u = fromMaybe bad $ parseURI url
|
||||
|
@ -128,7 +128,7 @@ fromRemotes repo = mapM construct remotepairs
|
|||
filterconfig f = filter f $ M.toList $ config repo
|
||||
filterkeys f = filterconfig (\(k,_) -> f k)
|
||||
remotepairs = filterkeys isremote
|
||||
isremote k = startswith "remote." k && endswith ".url" k
|
||||
isremote k = "remote." `isPrefixOf` k && ".url" `isSuffixOf` k
|
||||
construct (k,v) = remoteNamedFromKey k $ fromRemoteLocation v repo
|
||||
|
||||
{- Sets the name of a remote when constructing the Repo to represent it. -}
|
||||
|
|
|
@ -74,9 +74,9 @@ parseRemoteLocation s repo = ret $ calcloc s
|
|||
(bestkey, bestvalue) = maximumBy longestvalue insteadofs
|
||||
longestvalue (_, a) (_, b) = compare b a
|
||||
insteadofs = filterconfig $ \(k, v) ->
|
||||
startswith prefix k &&
|
||||
endswith suffix k &&
|
||||
startswith v l
|
||||
prefix `isPrefixOf` k &&
|
||||
suffix `isSuffixOf` k &&
|
||||
v `isPrefixOf` l
|
||||
filterconfig f = filter f $
|
||||
concatMap splitconfigs $ M.toList $ fullconfig repo
|
||||
splitconfigs (k, vs) = map (\v -> (k, v)) vs
|
||||
|
|
|
@ -39,10 +39,10 @@ import qualified Git.Branch as Branch
|
|||
import Utility.Tmp
|
||||
import Utility.Rsync
|
||||
import Utility.FileMode
|
||||
import Utility.Tuple
|
||||
|
||||
import qualified Data.Set as S
|
||||
import qualified Data.ByteString.Lazy as L
|
||||
import Data.Tuple.Utils
|
||||
|
||||
{- Given a set of bad objects found by git fsck, which may not
|
||||
- be complete, finds and removes all corrupt objects. -}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue