summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-05-11 16:03:50 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-05-11 16:05:01 -0400
commit54c524f1660e40e4b302279c7571cf2f9c9d5488 (patch)
tree6d0f7f20c7b0f8e0d175715c2b495e7a4b0b25ce
parent60dfbb240d4db6cb1a6f8ca9cf71400d461d8aa5 (diff)
de-Maybe remoteGitConfig
It's always set, so does not need to be a Maybe.
-rw-r--r--Command/Sync.hs2
-rw-r--r--Remote/GCrypt.hs2
-rw-r--r--Remote/Git.hs7
-rw-r--r--Remote/P2P.hs2
-rw-r--r--Types/GitConfig.hs6
5 files changed, 10 insertions, 9 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 85bb8c105..332daca73 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -417,7 +417,7 @@ pushRemote o remote (Just branch, _) = stopUnless (pure (pushOption o) <&&> need
-- Do updateInstead emulation for remotes on eg removable drives
-- formatted FAT, where the post-update hook won't run.
postpushupdate
- | maybe False annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) =
+ | annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) =
case Git.repoWorkTree (Remote.repo remote) of
Nothing -> return True
Just wt -> ifM (Remote.Git.onLocal remote needUpdateInsteadEmulation)
diff --git a/Remote/GCrypt.hs b/Remote/GCrypt.hs
index f1b48cdd2..ba28a7728 100644
--- a/Remote/GCrypt.hs
+++ b/Remote/GCrypt.hs
@@ -119,7 +119,7 @@ gen' r u c gc = do
, config = c
, localpath = localpathCalc r
, repo = r
- , gitconfig = gc { remoteGitConfig = Just $ extractGitConfig r }
+ , gitconfig = gc { remoteGitConfig = extractGitConfig r }
, readonly = Git.repoIsHttp r
, availability = availabilityCalc r
, remotetype = remote
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 78213f4f7..5c69473fd 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -165,8 +165,7 @@ gen r u c gc
, config = c
, localpath = localpathCalc r
, repo = r
- , gitconfig = gc
- { remoteGitConfig = Just $ extractGitConfig r }
+ , gitconfig = gc { remoteGitConfig = extractGitConfig r }
, readonly = Git.repoIsHttp r
, availability = availabilityCalc r
, remotetype = remote
@@ -351,7 +350,7 @@ keyUrls r key = map tourl locs'
locs' = map (replace "\\" "/") locs
#endif
remoteconfig = gitconfig r
- cfg = fromJust $ remoteGitConfig remoteconfig
+ cfg = remoteGitConfig remoteconfig
dropKey :: Remote -> Key -> Annex Bool
dropKey r key
@@ -520,7 +519,7 @@ copyFromRemoteCheap :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
copyFromRemoteCheap r key af file
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ liftIO $ do
loc <- gitAnnexLocation key (repo r) $
- fromJust $ remoteGitConfig $ gitconfig r
+ remoteGitConfig $ gitconfig r
ifM (doesFileExist loc)
( do
absloc <- absPath loc
diff --git a/Remote/P2P.hs b/Remote/P2P.hs
index ca555c30d..118262b3c 100644
--- a/Remote/P2P.hs
+++ b/Remote/P2P.hs
@@ -63,7 +63,7 @@ chainGen addr r u c gc = do
, config = c
, localpath = Nothing
, repo = r
- , gitconfig = gc { remoteGitConfig = Just $ extractGitConfig r }
+ , gitconfig = gc { remoteGitConfig = extractGitConfig r }
, readonly = False
, availability = GloballyAvailable
, remotetype = remote
diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs
index 714038070..f66136cb1 100644
--- a/Types/GitConfig.hs
+++ b/Types/GitConfig.hs
@@ -88,6 +88,7 @@ data GitConfig = GitConfig
, receiveDenyCurrentBranch :: DenyCurrentBranch
, gcryptId :: Maybe String
, gpgCmd :: GpgCmd
+ , gitConfigRepo :: Git.Repo
}
extractGitConfig :: Git.Repo -> GitConfig
@@ -148,6 +149,7 @@ extractGitConfig r = GitConfig
, receiveDenyCurrentBranch = getDenyCurrentBranch r
, gcryptId = getmaybe "core.gcrypt-id"
, gpgCmd = mkGpgCmd (getmaybe "gpg.program")
+ , gitConfigRepo = r
}
where
getbool k d = fromMaybe d $ getmaybebool k
@@ -216,7 +218,7 @@ data RemoteGitConfig = RemoteGitConfig
, remoteAnnexHookType :: Maybe String
, remoteAnnexExternalType :: Maybe String
{- A regular git remote's git repository config. -}
- , remoteGitConfig :: Maybe GitConfig
+ , remoteGitConfig :: GitConfig
}
extractRemoteGitConfig :: Git.Repo -> String -> RemoteGitConfig
@@ -252,7 +254,7 @@ extractRemoteGitConfig r remotename = RemoteGitConfig
, remoteAnnexDdarRepo = getmaybe "ddarrepo"
, remoteAnnexHookType = notempty $ getmaybe "hooktype"
, remoteAnnexExternalType = notempty $ getmaybe "externaltype"
- , remoteGitConfig = Nothing
+ , remoteGitConfig = extractGitConfig r
}
where
getbool k d = fromMaybe d $ getmaybebool k