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.
This commit is contained in:
parent
c6252018fa
commit
ef389722ae
6 changed files with 66 additions and 13 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue