summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-19 14:14:44 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-19 14:17:58 -0400
commitade0216bd08c2f9c1ed10c1c2274fd5b071c9c93 (patch)
tree6097def98c91ec5a0b6b9a694ab5b4b4137063c0 /Logs
parent8d0b3f09a9effc71f729d5b820076c642b605eb4 (diff)
pre-commit: Update metadata when committing changes to annexed files within a view.
So the user can now switch to a view and then move files around within it to manage metadata. For example, moving a file into a new directory when in the tags=* view adds a tag to it. Implementation is fairly efficient. One diff-index, which is no more expensive than the first stage of a git commit, followed by possibly some cat-file --batch traffic to find the key (when deleting a file). Very similar to what's done in direct mode when committing. And like direct mode when updating the WC after a merge, it has to buffer the diff-tree values in order to make 2 passes over them. When not in a view, pre-commit now does one extra git symbolic-ref, which is tiny overhead. This commit was sponsored by Andrew Eskridge.
Diffstat (limited to 'Logs')
-rw-r--r--Logs/MetaData.hs12
1 files changed, 0 insertions, 12 deletions
diff --git a/Logs/MetaData.hs b/Logs/MetaData.hs
index a959743df..807b50afa 100644
--- a/Logs/MetaData.hs
+++ b/Logs/MetaData.hs
@@ -28,8 +28,6 @@
module Logs.MetaData (
getCurrentMetaData,
getMetaData,
- setMetaData,
- unsetMetaData,
addMetaData,
addMetaData',
currentMetaData,
@@ -58,16 +56,6 @@ getCurrentMetaData = currentMetaData . collect <$$> getMetaData
where
collect = foldl' unionMetaData newMetaData . map value . S.toAscList
-setMetaData :: Key -> MetaField -> String -> Annex ()
-setMetaData = setMetaData' True
-
-unsetMetaData :: Key -> MetaField -> String -> Annex ()
-unsetMetaData = setMetaData' False
-
-setMetaData' :: Bool -> Key -> MetaField -> String -> Annex ()
-setMetaData' isset k field s = addMetaData k $
- updateMetaData field (mkMetaValue (CurrentlySet isset) s) newMetaData
-
{- Adds in some metadata, which can override existing values, or unset
- them, but otherwise leaves any existing metadata as-is. -}
addMetaData :: Key -> MetaData -> Annex ()