noCommit for PostReceive

This was noticed because it broke the datalad test suite, which pushed
to the remote and then fetched to check if it had received the expected
branches. Auto-init caused the git-annex branch on the remote to
diverge, breaking that test.

https://github.com/datalad/datalad/issues/1319#issuecomment-281649518

The auto-init still happens, it's staged in the journal, and will be
commited by some later git-annex command when it runs. Which is fine,
it's the same as that later command doing the auto-init.

This commit was supported by the NSF-funded DataLad project
This commit is contained in:
Joey Hess 2017-02-23 18:37:02 -04:00
parent 9bee19ed38
commit 3afc7d83f2
No known key found for this signature in database
GPG key ID: C910D9222512E3C7

View file

@ -13,8 +13,13 @@ import Git.Types
import Annex.UpdateInstead import Annex.UpdateInstead
import Command.Sync (mergeLocal, prepMerge, mergeConfig, getCurrBranch) import Command.Sync (mergeLocal, prepMerge, mergeConfig, getCurrBranch)
-- This does not need to modify the git-annex branch to update the
-- work tree, but auto-initialization might change the git-annex branch.
-- Since it would be surprising for a post-receive hook to make such a
-- change, that's prevented by noCommit.
cmd :: Command cmd :: Command
cmd = command "post-receive" SectionPlumbing cmd = noCommit $
command "post-receive" SectionPlumbing
"run by git post-receive hook" "run by git post-receive hook"
paramNothing paramNothing
(withParams seek) (withParams seek)