de-Maybe remoteGitConfig

It's always set, so does not need to be a Maybe.
This commit is contained in:
Joey Hess 2017-05-11 16:03:50 -04:00
parent a6416ba232
commit db1600b2de
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 10 additions and 9 deletions

View file

@ -417,7 +417,7 @@ pushRemote o remote (Just branch, _) = stopUnless (pure (pushOption o) <&&> need
-- Do updateInstead emulation for remotes on eg removable drives -- Do updateInstead emulation for remotes on eg removable drives
-- formatted FAT, where the post-update hook won't run. -- formatted FAT, where the post-update hook won't run.
postpushupdate postpushupdate
| maybe False annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) = | annexCrippledFileSystem (remoteGitConfig (Remote.gitconfig remote)) =
case Git.repoWorkTree (Remote.repo remote) of case Git.repoWorkTree (Remote.repo remote) of
Nothing -> return True Nothing -> return True
Just wt -> ifM (Remote.Git.onLocal remote needUpdateInsteadEmulation) Just wt -> ifM (Remote.Git.onLocal remote needUpdateInsteadEmulation)

View file

@ -119,7 +119,7 @@ gen' r u c gc = do
, config = c , config = c
, localpath = localpathCalc r , localpath = localpathCalc r
, repo = r , repo = r
, gitconfig = gc { remoteGitConfig = Just $ extractGitConfig r } , gitconfig = gc { remoteGitConfig = extractGitConfig r }
, readonly = Git.repoIsHttp r , readonly = Git.repoIsHttp r
, availability = availabilityCalc r , availability = availabilityCalc r
, remotetype = remote , remotetype = remote

View file

@ -165,8 +165,7 @@ gen r u c gc
, config = c , config = c
, localpath = localpathCalc r , localpath = localpathCalc r
, repo = r , repo = r
, gitconfig = gc , gitconfig = gc { remoteGitConfig = extractGitConfig r }
{ remoteGitConfig = Just $ extractGitConfig r }
, readonly = Git.repoIsHttp r , readonly = Git.repoIsHttp r
, availability = availabilityCalc r , availability = availabilityCalc r
, remotetype = remote , remotetype = remote
@ -351,7 +350,7 @@ keyUrls r key = map tourl locs'
locs' = map (replace "\\" "/") locs locs' = map (replace "\\" "/") locs
#endif #endif
remoteconfig = gitconfig r remoteconfig = gitconfig r
cfg = fromJust $ remoteGitConfig remoteconfig cfg = remoteGitConfig remoteconfig
dropKey :: Remote -> Key -> Annex Bool dropKey :: Remote -> Key -> Annex Bool
dropKey r key dropKey r key
@ -520,7 +519,7 @@ copyFromRemoteCheap :: Remote -> Key -> AssociatedFile -> FilePath -> Annex Bool
copyFromRemoteCheap r key af file copyFromRemoteCheap r key af file
| not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ liftIO $ do | not $ Git.repoIsUrl (repo r) = guardUsable (repo r) (return False) $ liftIO $ do
loc <- gitAnnexLocation key (repo r) $ loc <- gitAnnexLocation key (repo r) $
fromJust $ remoteGitConfig $ gitconfig r remoteGitConfig $ gitconfig r
ifM (doesFileExist loc) ifM (doesFileExist loc)
( do ( do
absloc <- absPath loc absloc <- absPath loc

View file

@ -63,7 +63,7 @@ chainGen addr r u c gc = do
, config = c , config = c
, localpath = Nothing , localpath = Nothing
, repo = r , repo = r
, gitconfig = gc { remoteGitConfig = Just $ extractGitConfig r } , gitconfig = gc { remoteGitConfig = extractGitConfig r }
, readonly = False , readonly = False
, availability = GloballyAvailable , availability = GloballyAvailable
, remotetype = remote , remotetype = remote

View file

@ -88,6 +88,7 @@ data GitConfig = GitConfig
, receiveDenyCurrentBranch :: DenyCurrentBranch , receiveDenyCurrentBranch :: DenyCurrentBranch
, gcryptId :: Maybe String , gcryptId :: Maybe String
, gpgCmd :: GpgCmd , gpgCmd :: GpgCmd
, gitConfigRepo :: Git.Repo
} }
extractGitConfig :: Git.Repo -> GitConfig extractGitConfig :: Git.Repo -> GitConfig
@ -148,6 +149,7 @@ extractGitConfig r = GitConfig
, receiveDenyCurrentBranch = getDenyCurrentBranch r , receiveDenyCurrentBranch = getDenyCurrentBranch r
, gcryptId = getmaybe "core.gcrypt-id" , gcryptId = getmaybe "core.gcrypt-id"
, gpgCmd = mkGpgCmd (getmaybe "gpg.program") , gpgCmd = mkGpgCmd (getmaybe "gpg.program")
, gitConfigRepo = r
} }
where where
getbool k d = fromMaybe d $ getmaybebool k getbool k d = fromMaybe d $ getmaybebool k
@ -216,7 +218,7 @@ data RemoteGitConfig = RemoteGitConfig
, remoteAnnexHookType :: Maybe String , remoteAnnexHookType :: Maybe String
, remoteAnnexExternalType :: Maybe String , remoteAnnexExternalType :: Maybe String
{- A regular git remote's git repository config. -} {- A regular git remote's git repository config. -}
, remoteGitConfig :: Maybe GitConfig , remoteGitConfig :: GitConfig
} }
extractRemoteGitConfig :: Git.Repo -> String -> RemoteGitConfig extractRemoteGitConfig :: Git.Repo -> String -> RemoteGitConfig
@ -252,7 +254,7 @@ extractRemoteGitConfig r remotename = RemoteGitConfig
, remoteAnnexDdarRepo = getmaybe "ddarrepo" , remoteAnnexDdarRepo = getmaybe "ddarrepo"
, remoteAnnexHookType = notempty $ getmaybe "hooktype" , remoteAnnexHookType = notempty $ getmaybe "hooktype"
, remoteAnnexExternalType = notempty $ getmaybe "externaltype" , remoteAnnexExternalType = notempty $ getmaybe "externaltype"
, remoteGitConfig = Nothing , remoteGitConfig = extractGitConfig r
} }
where where
getbool k d = fromMaybe d $ getmaybebool k getbool k d = fromMaybe d $ getmaybebool k