summaryrefslogtreecommitdiff
path: root/Command/PreCommit.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-05-31 16:08:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-05-31 16:08:37 -0400
commit038da52bdd94311e4b9512a21952ce0f256643e0 (patch)
treeeb46218e139382afd9081bc1c40c71e61983a04d /Command/PreCommit.hs
parentfb259033d44cda1e2470d5029940d7b0725b4add (diff)
Somewhat sped up `git commit` of modifications to unlocked files.
Avoid git reset here too, so I no longer need to care that it's much more expensive than seems wise (but I asked the git list about that anyway). It's not necessary to reset the staged file content from the index, as the `git add` of the the symlink will replace it anyway. `git commit` of unlocked files is still slow, since git still has to shove their entire content into the index, only to have it be thrown away. So it's still better to use `git annex add`
Diffstat (limited to 'Command/PreCommit.hs')
-rw-r--r--Command/PreCommit.hs12
1 files changed, 1 insertions, 11 deletions
diff --git a/Command/PreCommit.hs b/Command/PreCommit.hs
index d7f248713..6d8f7b9b3 100644
--- a/Command/PreCommit.hs
+++ b/Command/PreCommit.hs
@@ -33,15 +33,5 @@ perform :: BackendFile -> CommandPerform
perform pair@(file, _) = do
ok <- doCommand $ Command.Add.start pair
if ok
- then next $ cleanup file
+ then next $ return True
else error $ "failed to add " ++ file ++ "; canceling commit"
-
-cleanup :: FilePath -> CommandCleanup
-cleanup file = do
- -- git commit will have staged the file's content;
- -- drop that and run command queued by Add.state to
- -- stage the symlink
- g <- Annex.gitRepo
- liftIO $ Git.run g "reset" [Params "-q --", File file]
- AnnexQueue.flush True
- return True