diff options
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r-- | Command/PreCommit.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs index 4b90b5c2e..fa34ad245 100644 --- a/Command/PreCommit.hs +++ b/Command/PreCommit.hs @@ -13,7 +13,9 @@ import Config import qualified Command.Add import qualified Command.Fix import Annex.Direct +import Annex.Hook import Annex.View +import Annex.View.ViewedFile import Logs.View import Logs.MetaData import Types.View @@ -27,13 +29,16 @@ def = [command "pre-commit" paramPaths seek SectionPlumbing seek :: CommandSeek seek ps = ifM isDirect - -- update direct mode mappings for committed files - ( withWords startDirect ps + ( do + -- update direct mode mappings for committed files + withWords startDirect ps + runAnnexHook preCommitAnnexHook , do -- fix symlinks to files being committed withFilesToBeCommitted (whenAnnexed Command.Fix.start) ps -- inject unlocked files into the annex withFilesUnlockedToBeCommitted startIndirect ps + runAnnexHook preCommitAnnexHook -- committing changes to a view updates metadata mv <- currentView case mv of @@ -42,6 +47,7 @@ seek ps = ifM isDirect (addViewMetaData v) (removeViewMetaData v) ) + startIndirect :: FilePath -> CommandStart startIndirect f = next $ do @@ -52,12 +58,12 @@ startIndirect f = next $ do startDirect :: [String] -> CommandStart startDirect _ = next $ next $ preCommitDirect -addViewMetaData :: View -> FileView -> Key -> CommandStart +addViewMetaData :: View -> ViewedFile -> Key -> CommandStart addViewMetaData v f k = do showStart "metadata" f next $ next $ changeMetaData k $ fromView v f -removeViewMetaData :: View -> FileView -> Key -> CommandStart +removeViewMetaData :: View -> ViewedFile -> Key -> CommandStart removeViewMetaData v f k = do showStart "metadata" f next $ next $ changeMetaData k $ unsetMetaData $ fromView v f |