summaryrefslogtreecommitdiff
path: root/Types/MetaData.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-04-04 13:42:15 -0400
committerJoey Hess <joeyh@joeyh.name>2018-04-04 13:58:16 -0400
commitef389722ae28fbb2520927a62cfce10e0b3b8782 (patch)
tree15a6b5b87f26f4ad14e4e2dbc63bad3e69eba742 /Types/MetaData.hs
parentc6252018faf373ad372e68eb0a0cb4a446505aea (diff)
don't copy old date metadata when adding new version of a file
When adding a new version of a file, and annex.genmetadata is enabled, don't copy the data metadata from the old version of the file, instead use the mtime of the file. Rationalle being that the user has requested to generate metadata and so would expect to get the new mtime into metadata. Also, avoid warning about copying metadata when all the old metadata is date metadata. Which was rather the harder part. This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
Diffstat (limited to 'Types/MetaData.hs')
-rw-r--r--Types/MetaData.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Types/MetaData.hs b/Types/MetaData.hs
index bc27c345f4..279aacbb84 100644
--- a/Types/MetaData.hs
+++ b/Types/MetaData.hs
@@ -252,13 +252,15 @@ data ModMeta
= AddMeta MetaField MetaValue
| DelMeta MetaField (Maybe MetaValue)
-- ^ delete value of a field. With Just, only that specific value
- -- is deleted; with Nothing, all current values are deleted.a
+ -- is deleted; with Nothing, all current values are deleted.
| DelAllMeta
-- ^ delete all currently set metadata
| SetMeta MetaField (S.Set MetaValue)
-- ^ removes any existing values
| MaybeSetMeta MetaField MetaValue
-- ^ set when field has no existing value
+ | ComposeModMeta ModMeta ModMeta
+ -- ^ composing multiple modifications
deriving (Show)
{- Applies a ModMeta, generating the new MetaData.
@@ -279,6 +281,7 @@ modMeta m (SetMeta f s) = updateMetaData' f s $
modMeta m (MaybeSetMeta f v)
| S.null (currentMetaDataValues f m) = updateMetaData f v emptyMetaData
| otherwise = emptyMetaData
+modMeta m (ComposeModMeta a b) = unionMetaData (modMeta m a) (modMeta m b)
{- Avoid putting too many fields in the map; extremely large maps make
- the seriaization test slow due to the sheer amount of data.