fix some build warnings from ghc 9.4.6

It now notices that a RepoLocation may not be Local, in which case
pattern matching on Local wouldn't do.
This commit is contained in:
Joey Hess 2023-09-21 13:40:22 -04:00
parent a147a31baa
commit ef7c867238
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 6 additions and 3 deletions

View file

@ -43,8 +43,10 @@ fixPostReceiveHookEnv = do
case location g of
Local { gitdir = ".", worktree = Just "." } ->
Annex.adjustGitRepo $ \g' -> pure $ g'
{ location = (location g')
{ worktree = Just ".." }
{ location = case location g' of
loc@(Local {}) -> loc
{ worktree = Just ".." }
loc -> loc
}
_ -> noop

View file

@ -175,7 +175,7 @@ updateLocation r@(Repo { location = l@(Local {}) }) = updateLocation' r l
updateLocation r = return r
updateLocation' :: Repo -> RepoLocation -> IO Repo
updateLocation' r l = do
updateLocation' r l@(Local {}) = do
l' <- case getMaybe "core.worktree" r of
Nothing -> return l
Just (ConfigValue d) -> do
@ -185,6 +185,7 @@ updateLocation' r l = do
return $ l { worktree = Just p }
Just NoConfigValue -> return l
return $ r { location = l' }
updateLocation' r l = return r { location = l }
data ConfigStyle = ConfigList | ConfigNullList