From 740e0ddbfec730b91b8dd19bb379ed916c801922 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 21 Nov 2019 14:31:12 -0400 Subject: [PATCH] avoid running scanUnlockedFiles in bare repo It's not necessary. And if the bare repo somehow has a pointer file in it with the same name as a file in HEAD, that file would be populated, which would be surprising since the file is not really under git's control. --- Annex/Init.hs | 4 ++-- Annex/WorkTree.hs | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Annex/Init.hs b/Annex/Init.hs index 1bc82710f4..a762bf690c 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -108,9 +108,9 @@ initialize' mversion = checkCanInitialize $ do unlessM (isJust <$> getVersion) $ setVersion (fromMaybe defaultVersion mversion) configureSmudgeFilter - showSideAction "scanning for unlocked files" - scanUnlockedFiles unlessM isBareRepo $ do + showSideAction "scanning for unlocked files" + scanUnlockedFiles hookWrite postCheckoutHook hookWrite postMergeHook AdjustedBranch.checkAdjustedClone >>= \case diff --git a/Annex/WorkTree.hs b/Annex/WorkTree.hs index cf40f527bf..b04eeac4d8 100644 --- a/Annex/WorkTree.hs +++ b/Annex/WorkTree.hs @@ -22,6 +22,7 @@ import qualified Git.Types import Database.Types import qualified Database.Keys import qualified Database.Keys.SQL +import Config {- Looks up the key corresponding to an annexed file in the work tree, - by examining what the file links to. @@ -75,7 +76,7 @@ ifAnnexed file yes no = maybe no yes =<< lookupFile file - as-is. -} scanUnlockedFiles :: Annex () -scanUnlockedFiles = whenM (inRepo Git.Ref.headExists) $ do +scanUnlockedFiles = whenM (inRepo Git.Ref.headExists <&&> not <$> isBareRepo) $ do Database.Keys.runWriter $ liftIO . Database.Keys.SQL.dropAllAssociatedFiles (l, cleanup) <- inRepo $ Git.LsTree.lsTree Git.LsTree.LsTreeRecursive Git.Ref.headRef