tweaks
This commit is contained in:
parent
1118b4a646
commit
9c7b3dce9e
2 changed files with 13 additions and 9 deletions
18
GitRepo.hs
18
GitRepo.hs
|
@ -24,6 +24,7 @@ module GitRepo (
|
|||
configGet,
|
||||
configMap,
|
||||
configRead,
|
||||
configTrue,
|
||||
run,
|
||||
pipeRead,
|
||||
attributes,
|
||||
|
@ -47,6 +48,7 @@ import Data.String.Utils
|
|||
import Data.Map as Map hiding (map, split)
|
||||
import Network.URI
|
||||
import Maybe
|
||||
import Char
|
||||
|
||||
import Utility
|
||||
|
||||
|
@ -127,13 +129,11 @@ assertssh repo action =
|
|||
then action
|
||||
else error $ "unsupported url " ++ (show $ url repo)
|
||||
bare :: Repo -> Bool
|
||||
bare repo =
|
||||
if (member b (config repo))
|
||||
then ("true" == fromJust (Map.lookup b (config repo)))
|
||||
else error $ "it is not known if git repo " ++ (repoDescribe repo) ++
|
||||
bare repo = case Map.lookup "core.bare" $ config repo of
|
||||
Just v -> configTrue v
|
||||
Nothing -> error $ "it is not known if git repo " ++
|
||||
(repoDescribe repo) ++
|
||||
" is a bare repository; config not read"
|
||||
where
|
||||
b = "core.bare"
|
||||
|
||||
{- Path to a repository's gitattributes file. -}
|
||||
attributes :: Repo -> String
|
||||
|
@ -173,7 +173,7 @@ relative repo file = assertLocal repo $ drop (length absrepo) absfile
|
|||
{- Hostname of an URL repo. (May include a username and/or port too.) -}
|
||||
urlHost :: Repo -> String
|
||||
urlHost repo = assertUrl repo $
|
||||
(uriUserInfo a) ++ (uriRegName a) ++ (uriPort a)
|
||||
uriUserInfo a ++ uriRegName a ++ uriPort a
|
||||
where
|
||||
a = fromJust $ uriAuthority $ url repo
|
||||
|
||||
|
@ -235,6 +235,10 @@ configRead repo =
|
|||
let r = repo { config = configParse val }
|
||||
return r { remotes = configRemotes r }
|
||||
|
||||
{- Checks if a string fron git config is a true value. -}
|
||||
configTrue :: String -> Bool
|
||||
configTrue s = map toLower s == "true"
|
||||
|
||||
{- Calculates a list of a repo's configured remotes, by parsing its config. -}
|
||||
configRemotes :: Repo -> [Repo]
|
||||
configRemotes repo = map construct remotes
|
||||
|
|
|
@ -139,10 +139,10 @@ repoNotIgnored r = do
|
|||
let name = if (not $ null fromName) then fromName else toName
|
||||
if (not $ null name)
|
||||
then return $ match name
|
||||
else return $ notignored g
|
||||
else return $ not $ ignored g
|
||||
where
|
||||
match name = name == Git.repoRemoteName r
|
||||
notignored g = "true" /= config g
|
||||
ignored g = Git.configTrue $ config g
|
||||
config g = Git.configGet g configkey ""
|
||||
configkey = "remote." ++ (Git.repoRemoteName r) ++ ".annex-ignore"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue