aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-02-23 18:37:02 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-02-23 18:37:02 -0400
commita6191e2476ebe4f1722f1cac9f2569a7e2d2a09c (patch)
tree261f76b0f4a0fd2f5f7177b03960b1c86471e262 /Command
parenta6ee171c9b2b50598f909ac8ed01355cb06bfd15 (diff)
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
Diffstat (limited to 'Command')
-rw-r--r--Command/PostReceive.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/Command/PostReceive.hs b/Command/PostReceive.hs
index 84652f20d..ffb5516a2 100644
--- a/Command/PostReceive.hs
+++ b/Command/PostReceive.hs
@@ -13,11 +13,16 @@ import Git.Types
import Annex.UpdateInstead
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 "post-receive" SectionPlumbing
- "run by git post-receive hook"
- paramNothing
- (withParams seek)
+cmd = noCommit $
+ command "post-receive" SectionPlumbing
+ "run by git post-receive hook"
+ paramNothing
+ (withParams seek)
seek :: CmdParams -> CommandSeek
seek _ = whenM needUpdateInsteadEmulation $ do