remove whenAnnexed and ifAnnexed

In preparation for adding a new variation on lookupKey.

Sponsored-by: Max Thoursie on Patreon
This commit is contained in:
Joey Hess 2022-10-26 13:58:20 -04:00
parent 1944549a38
commit b2ee2496ee
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
12 changed files with 56 additions and 36 deletions

View file

@ -28,6 +28,7 @@ import Utility.DiskFree
import Annex.Content
import Annex.UUID
import Annex.CatFile
import Annex.WorkTree
import Logs.UUID
import Logs.Trust
import Logs.Location
@ -174,9 +175,9 @@ itemInfo o (si, p) = ifM (isdir p)
Right u -> uuidInfo o u si
Left _ -> do
relp <- liftIO $ relPathCwdToFile (toRawFilePath p)
ifAnnexed relp
(fileInfo o (fromRawFilePath relp) si)
(treeishInfo o p si)
lookupKey relp >>= \case
Just k -> fileInfo o (fromRawFilePath relp) si k
Nothing -> treeishInfo o p si
)
where
isdir = liftIO . catchBoolIO . (isDirectory <$$> getFileStatus)