Added a post-update-annex hook, which is run after the git-annex branch is updated. Needed for git update-server-info.
See https://github.com/datalad/datalad/issues/1#issuecomment-84094406
This commit is contained in:
parent
dd35cf34a4
commit
798da6cf2e
4 changed files with 23 additions and 9 deletions
|
@ -55,6 +55,7 @@ import Annex.ReplaceFile
|
||||||
import qualified Annex.Queue
|
import qualified Annex.Queue
|
||||||
import Annex.Branch.Transitions
|
import Annex.Branch.Transitions
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
import Annex.Hook
|
||||||
|
|
||||||
{- Name of the branch that is used to store git-annex's information. -}
|
{- Name of the branch that is used to store git-annex's information. -}
|
||||||
name :: Git.Ref
|
name :: Git.Ref
|
||||||
|
@ -166,13 +167,16 @@ updateTo pairs = do
|
||||||
mapM_ checkBranchDifferences refs
|
mapM_ checkBranchDifferences refs
|
||||||
mergeIndex jl refs
|
mergeIndex jl refs
|
||||||
let commitrefs = nub $ fullname:refs
|
let commitrefs = nub $ fullname:refs
|
||||||
unlessM (handleTransitions jl localtransitions commitrefs) $ do
|
ifM (handleTransitions jl localtransitions commitrefs)
|
||||||
|
( runAnnexHook postUpdateAnnexHook
|
||||||
|
, do
|
||||||
ff <- if dirty
|
ff <- if dirty
|
||||||
then return False
|
then return False
|
||||||
else inRepo $ Git.Branch.fastForward fullname refs
|
else inRepo $ Git.Branch.fastForward fullname refs
|
||||||
if ff
|
if ff
|
||||||
then updateIndex jl branchref
|
then updateIndex jl branchref
|
||||||
else commitIndex jl branchref merge_desc commitrefs
|
else commitIndex jl branchref merge_desc commitrefs
|
||||||
|
)
|
||||||
liftIO cleanjournal
|
liftIO cleanjournal
|
||||||
|
|
||||||
{- Gets the content of a file, which may be in the journal, or in the index
|
{- 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
|
f <- fromRepo gitAnnexIndexStatus
|
||||||
liftIO $ writeFile f $ fromRef ref ++ "\n"
|
liftIO $ writeFile f $ fromRef ref ++ "\n"
|
||||||
setAnnexFilePerm f
|
setAnnexFilePerm f
|
||||||
|
runAnnexHook postUpdateAnnexHook
|
||||||
|
|
||||||
{- Stages the journal into the index and returns an action that will
|
{- Stages the journal into the index and returns an action that will
|
||||||
- clean up the staged journal files, which should only be run once
|
- clean up the staged journal files, which should only be run once
|
||||||
|
|
|
@ -25,6 +25,9 @@ preCommitHook = Git.Hook "pre-commit" (mkHookScript "git annex pre-commit .")
|
||||||
preCommitAnnexHook :: Git.Hook
|
preCommitAnnexHook :: Git.Hook
|
||||||
preCommitAnnexHook = Git.Hook "pre-commit-annex" ""
|
preCommitAnnexHook = Git.Hook "pre-commit-annex" ""
|
||||||
|
|
||||||
|
postUpdateAnnexHook :: Git.Hook
|
||||||
|
postUpdateAnnexHook = Git.Hook "post-update-annex" ""
|
||||||
|
|
||||||
mkHookScript :: String -> String
|
mkHookScript :: String -> String
|
||||||
mkHookScript s = unlines
|
mkHookScript s = unlines
|
||||||
[ shebang_local
|
[ shebang_local
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -3,6 +3,8 @@ git-annex (5.20150318) UNRELEASED; urgency=medium
|
||||||
* readpresentkey: New plumbing command for checking location log.
|
* readpresentkey: New plumbing command for checking location log.
|
||||||
* checkpresentkey: New plumbing command to check if a key can be verified
|
* checkpresentkey: New plumbing command to check if a key can be verified
|
||||||
to be present on a remote.
|
to be present on a remote.
|
||||||
|
* Added a post-update-annex hook, which is run after the git-annex branch
|
||||||
|
is updated. Needed for git update-server-info.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400
|
||||||
|
|
||||||
|
|
|
@ -1953,8 +1953,12 @@ used by git-annex.
|
||||||
to start the git-annex assistant in.
|
to start the git-annex assistant in.
|
||||||
|
|
||||||
`.git/hooks/pre-commit-annex` in your git repository will be run whenever
|
`.git/hooks/pre-commit-annex` in your git repository will be run whenever
|
||||||
a commit is made, either by git commit, git-annex sync, or the git-annex
|
a commit is made to the HEAD branch, either by git commit, git-annex
|
||||||
assistant.
|
sync, or the git-annex assistant.
|
||||||
|
|
||||||
|
`.git/hooks/post-update-annex` in your git repository will be run
|
||||||
|
whenever the git-annex branch is updated. You can make this hook run
|
||||||
|
`git update-server-info` when publishing a git-annex repository by http.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue