summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Branch.hs19
-rw-r--r--Annex/Hook.hs3
2 files changed, 15 insertions, 7 deletions
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index 6ce711996..7cd86c581 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -55,6 +55,7 @@ import Annex.ReplaceFile
import qualified Annex.Queue
import Annex.Branch.Transitions
import qualified Annex
+import Annex.Hook
{- Name of the branch that is used to store git-annex's information. -}
name :: Git.Ref
@@ -166,13 +167,16 @@ updateTo pairs = do
mapM_ checkBranchDifferences refs
mergeIndex jl refs
let commitrefs = nub $ fullname:refs
- unlessM (handleTransitions jl localtransitions commitrefs) $ do
- ff <- if dirty
- then return False
- else inRepo $ Git.Branch.fastForward fullname refs
- if ff
- then updateIndex jl branchref
- else commitIndex jl branchref merge_desc commitrefs
+ ifM (handleTransitions jl localtransitions commitrefs)
+ ( runAnnexHook postUpdateAnnexHook
+ , do
+ ff <- if dirty
+ then return False
+ else inRepo $ Git.Branch.fastForward fullname refs
+ if ff
+ then updateIndex jl branchref
+ else commitIndex jl branchref merge_desc commitrefs
+ )
liftIO cleanjournal
{- Gets the content of a file, which may be in the journal, or in the index
@@ -384,6 +388,7 @@ setIndexSha ref = do
f <- fromRepo gitAnnexIndexStatus
liftIO $ writeFile f $ fromRef ref ++ "\n"
setAnnexFilePerm f
+ runAnnexHook postUpdateAnnexHook
{- Stages the journal into the index and returns an action that will
- clean up the staged journal files, which should only be run once
diff --git a/Annex/Hook.hs b/Annex/Hook.hs
index 253c77a60..1c17e03b4 100644
--- a/Annex/Hook.hs
+++ b/Annex/Hook.hs
@@ -25,6 +25,9 @@ preCommitHook = Git.Hook "pre-commit" (mkHookScript "git annex pre-commit .")
preCommitAnnexHook :: Git.Hook
preCommitAnnexHook = Git.Hook "pre-commit-annex" ""
+postUpdateAnnexHook :: Git.Hook
+postUpdateAnnexHook = Git.Hook "post-update-annex" ""
+
mkHookScript :: String -> String
mkHookScript s = unlines
[ shebang_local