summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-06 12:40:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-06 12:44:19 -0400
commit48d59dbad11a2f99a0003f5f3bd93734429be11d (patch)
treeef74a5cb149d78c8dc3e74732ae52f5afb73f274 /Assistant
parent6be68947dcf80c99ed5135c1a968641dca199555 (diff)
pre-commit: Update direct mode mappings.
Making the pre-commit hook look at git diff-index to find changed direct mode files and update the mappings works pretty well. One case where it does not work is when a file is git annex added, and then git rmed, and then this is committed. That's a no-op commit, so the hook probably doesn't even run, and it certianly never notices that the file was deleted, so the mapping will still have the original filename in it. For this and other reasons, it's important that the mappings still be treated as possibly inconsistent. Also, the assistant now allows the pre-commit hook to run when in direct mode, so the mappings also get updated there.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/Committer.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 3d0148b02..d90b0e1cb 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -82,12 +82,16 @@ commitStaged = do
case v of
Left _ -> return False
Right _ -> do
- void $ inRepo $ Git.Command.runBool "commit" $ nomessage
- [ Param "--quiet"
- {- Avoid running the usual git-annex pre-commit hook;
- - watch does the same symlink fixing, and we don't want
- - to deal with unlocked files in these commits. -}
- , Param "--no-verify"
+ direct <- isDirect
+ void $ inRepo $ Git.Command.runBool "commit" $ nomessage $
+ catMaybes
+ [ Just $ Param "--quiet"
+ {- In indirect mode, avoid running the
+ - usual git-annex pre-commit hook;
+ - watch does the same symlink fixing,
+ - and we don't want to deal with unlocked
+ - files in these commits. -}
+ , if direct then Nothing else Just $ Param "--no-verify"
]
{- Empty commits may be made if tree changes cancel
- each other out, etc. Git returns nonzero on those,