diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-08-11 13:19:01 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-08-11 13:19:01 -0400 |
commit | 7f03b97ea3631f266c188f49475685ab9d507783 (patch) | |
tree | 5cce8142e2bac0d4c2769d235e16fe44e342c825 | |
parent | f42f4fe966e317b984f51a32f5716f92e724ceef (diff) |
metadata: Fix reversion introduced in 5.20150727 that caused display of metadata to not work.
-rw-r--r-- | CmdLine/Seek.hs | 9 | ||||
-rw-r--r-- | Command/MetaData.hs | 29 | ||||
-rw-r--r-- | debian/changelog | 2 |
3 files changed, 22 insertions, 18 deletions
diff --git a/CmdLine/Seek.hs b/CmdLine/Seek.hs index e67c3b908..8d253e47d 100644 --- a/CmdLine/Seek.hs +++ b/CmdLine/Seek.hs @@ -33,11 +33,11 @@ withFilesInGit :: (FilePath -> CommandStart) -> CmdParams -> CommandSeek withFilesInGit a params = seekActions $ prepFiltered a $ seekHelper LsFiles.inRepo params -withFilesInGitNonRecursive :: (FilePath -> CommandStart) -> CmdParams -> CommandSeek -withFilesInGitNonRecursive a params = ifM (Annex.getState Annex.force) +withFilesInGitNonRecursive :: String -> (FilePath -> CommandStart) -> CmdParams -> CommandSeek +withFilesInGitNonRecursive needforce a params = ifM (Annex.getState Annex.force) ( withFilesInGit a params , if null params - then needforce + then error needforce else seekActions $ prepFiltered a (getfiles [] params) ) where @@ -51,8 +51,7 @@ withFilesInGitNonRecursive a params = ifM (Annex.getState Annex.force) [] -> do void $ liftIO $ cleanup getfiles c ps - _ -> needforce - needforce = error "Not recursively setting metadata. Use --force to do that." + _ -> error needforce withFilesNotInGit :: Bool -> (FilePath -> CommandStart) -> CmdParams -> CommandSeek withFilesNotInGit skipdotfiles a params diff --git a/Command/MetaData.hs b/Command/MetaData.hs index b0076b4cd..788c0f2ff 100644 --- a/Command/MetaData.hs +++ b/Command/MetaData.hs @@ -27,12 +27,12 @@ data MetaDataOptions = MetaDataOptions , keyOptions :: Maybe KeyOptions } -data GetSet = Get MetaField | Set [ModMeta] +data GetSet = Get MetaField | GetAll | Set [ModMeta] optParser :: CmdParamsDesc -> Parser MetaDataOptions optParser desc = MetaDataOptions <$> cmdParams desc - <*> ((Get <$> getopt) <|> (Set <$> many modopts)) + <*> ((Get <$> getopt) <|> (Set <$> some modopts) <|> pure GetAll) <*> optional (parseKeyOptions False) where getopt = option (eitherReader mkMetaField) @@ -57,7 +57,9 @@ seek o = do now <- liftIO getPOSIXTime let seeker = case getSet o of Get _ -> withFilesInGit + GetAll -> withFilesInGit Set _ -> withFilesInGitNonRecursive + "Not recursively setting metadata. Use --force to do that." withKeyOptions (keyOptions o) False (startKeys now o) (seeker $ whenAnnexed $ start now o) @@ -71,23 +73,24 @@ startKeys = start' Nothing start' :: AssociatedFile -> POSIXTime -> MetaDataOptions -> Key -> CommandStart start' afile now o k = case getSet o of - Set ms -> do - showStart' "metadata" k afile - next $ perform now ms k Get f -> do l <- S.toList . currentMetaDataValues f <$> getCurrentMetaData k liftIO $ forM_ l $ putStrLn . fromMetaValue stop + _ -> do + showStart' "metadata" k afile + next $ perform now o k + +perform :: POSIXTime -> MetaDataOptions -> Key -> CommandPerform +perform now o k = case getSet o of + Set ms -> do + oldm <- getCurrentMetaData k + let m = combineMetaData $ map (modMeta oldm) ms + addMetaData' k m now + next $ cleanup k + _ -> next $ cleanup k -perform :: POSIXTime -> [ModMeta] -> Key -> CommandPerform -perform _ [] k = next $ cleanup k -perform now ms k = do - oldm <- getCurrentMetaData k - let m = combineMetaData $ map (modMeta oldm) ms - addMetaData' k m now - next $ cleanup k - cleanup :: Key -> CommandCleanup cleanup k = do l <- map unwrapmeta . fromMetaData <$> getCurrentMetaData k diff --git a/debian/changelog b/debian/changelog index 6c9ec336e..789d0f8cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ git-annex (5.20150732) UNRELEASED; urgency=medium built using the cryptonite library. * Improve Setup.hs file so that cabal copy --destdir works. Thanks, Magnus Therning. + * metadata: Fix reversion introduced in 5.20150727 that caused display + of metadata to not work. -- Joey Hess <id@joeyh.name> Fri, 31 Jul 2015 12:31:39 -0400 |