diff --git a/Command/PostReceive.hs b/Command/PostReceive.hs index ec0678383f..fd92bae4a4 100644 --- a/Command/PostReceive.hs +++ b/Command/PostReceive.hs @@ -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 diff --git a/Git/Config.hs b/Git/Config.hs index 0d407e4680..4423ea6d48 100644 --- a/Git/Config.hs +++ b/Git/Config.hs @@ -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