fix some build warnings from ghc 9.4.6
authorJoey Hess <joeyh@joeyh.name>
Thu, 21 Sep 2023 17:40:22 +0000 (13:40 -0400)
committerJoey Hess <joeyh@joeyh.name>
Thu, 21 Sep 2023 17:40:22 +0000 (13:40 -0400)
It now notices that a RepoLocation may not be Local, in which case
pattern matching on Local wouldn't do.

Command/PostReceive.hs
Git/Config.hs

index ec0678383fe4f4f50a79c0922ec9badf8f7eb20d..fd92bae4a42f22001ad3c2bc74f7d8d92150099e 100644 (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
 
index 0d407e4680d1d3bc59ed11047f6e0e6da77d8190..4423ea6d48e333bd6664263e1f19bae723de79db 100644 (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