fix init default description reversion
init: Fix a reversion in the last release that prevented automatically generating and setting a description for the repository. Seemed best to factor out uuidDescMapRaw that does not have the default mempty descrition behavior. I don't much like that behavior, but I know things depend on it. One thing in particular is `git annex info` which lists the uuids and descriptions; if the current repo has been initialized in some way that means it does not have a description, it would not show up w/o that. (Not only repos created due to this bug might lack that. For example a repo that was marked dead and had --drop-dead delete its git-annex branch info, and then came back from the dead would similarly not be in the uuid.log. Also there have been other versions of git-annex that didn't set a default description; for years there was no default description.)
This commit is contained in:
parent
7264203eb1
commit
84e729fda5
5 changed files with 28 additions and 6 deletions
15
Logs/UUID.hs
15
Logs/UUID.hs
|
@ -11,7 +11,8 @@ module Logs.UUID (
|
|||
uuidLog,
|
||||
describeUUID,
|
||||
uuidDescMap,
|
||||
uuidDescMapLoad
|
||||
uuidDescMapLoad,
|
||||
uuidDescMapRaw,
|
||||
) where
|
||||
|
||||
import Types.UUID
|
||||
|
@ -38,13 +39,13 @@ describeUUID uuid desc = do
|
|||
uuidDescMap :: Annex UUIDDescMap
|
||||
uuidDescMap = maybe uuidDescMapLoad return =<< Annex.getState Annex.uuiddescmap
|
||||
|
||||
{- Read the uuidLog into a simple Map.
|
||||
{- Read the uuidLog into a map, and cache it for later use.
|
||||
-
|
||||
- The UUID of the current repository is included explicitly, since
|
||||
- it may not have been described and otherwise would not appear. -}
|
||||
- If the current repository has not been described, it is still included
|
||||
- in the map with an empty description. -}
|
||||
uuidDescMapLoad :: Annex UUIDDescMap
|
||||
uuidDescMapLoad = do
|
||||
m <- simpleMap . parseUUIDLog <$> Annex.Branch.get uuidLog
|
||||
m <- uuidDescMapRaw
|
||||
u <- Annex.UUID.getUUID
|
||||
let m' = M.insertWith preferold u mempty m
|
||||
Annex.changeState $ \s -> s { Annex.uuiddescmap = Just m' }
|
||||
|
@ -52,5 +53,9 @@ uuidDescMapLoad = do
|
|||
where
|
||||
preferold = flip const
|
||||
|
||||
{- Read the uuidLog into a map. Includes only actually set descriptions. -}
|
||||
uuidDescMapRaw :: Annex UUIDDescMap
|
||||
uuidDescMapRaw = simpleMap . parseUUIDLog <$> Annex.Branch.get uuidLog
|
||||
|
||||
parseUUIDLog :: L.ByteString -> Log UUIDDesc
|
||||
parseUUIDLog = parseLogOld (UUIDDesc <$> A.takeByteString)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue