summaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs36
1 files changed, 15 insertions, 21 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index d0dedd4fd..286a8c645 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -42,33 +42,27 @@ list = do
g <- Annex.gitRepo
return $ Git.remotes g
-gen :: Git.Repo -> Maybe (M.Map String String) -> Annex (Remote Annex)
-gen repo _ = do
+gen :: Git.Repo -> UUID -> Cost -> Maybe (M.Map String String) -> Annex (Remote Annex)
+gen r u cst _ = do
{- It's assumed to be cheap to read the config of non-URL remotes,
- so this is done each time git-annex is run. Conversely,
- the config of an URL remote is only read when there is no
- cached UUID value. -}
- let cheap = not $ Git.repoIsUrl repo
- u <- getUUID repo
- repo' <- case (cheap, u) of
- (True, _) -> tryGitConfigRead repo
- (False, "") -> tryGitConfigRead repo
- _ -> return repo
- genRemote repo'
-
-genRemote :: Git.Repo -> Annex (Remote Annex)
-genRemote r = do
- u <- getUUID r
- c <- remoteCost r
+ let cheap = not $ Git.repoIsUrl r
+ r' <- case (cheap, u) of
+ (True, _) -> tryGitConfigRead r
+ (False, "") -> tryGitConfigRead r
+ _ -> return r
+
return $ Remote {
uuid = u,
- cost = c,
- name = Git.repoDescribe r,
- storeKey = copyToRemote r,
- retrieveKeyFile = copyFromRemote r,
- removeKey = dropKey r,
- hasKey = inAnnex r,
- hasKeyCheap = not (Git.repoIsUrl r),
+ cost = cst,
+ name = Git.repoDescribe r',
+ storeKey = copyToRemote r',
+ retrieveKeyFile = copyFromRemote r',
+ removeKey = dropKey r',
+ hasKey = inAnnex r',
+ hasKeyCheap = not (Git.repoIsUrl r'),
config = Nothing
}