summaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-12-01 13:59:39 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-12-01 13:59:45 -0400
commit91bf77fae4e0645d466db01a9a45f6a380c933f7 (patch)
treea2e57e048dfb9c40edd6ae74d293ec92beb23eb1 /Assistant
parent05224f307e37aa51b8daa11ce2d2657e4b41bed3 (diff)
Avoid using git commit in direct mode, since in some situations it will read the full contents of files in the tree.
The assistant's commit code also always avoids git commit, for simplicity. Indirect mode sync still does a git commit -a to catch unstaged changes. Note that this means that direct mode sync no longer runs the pre-commit hook or any other hooks git commit might call. The git annex pre-commit hook action for direct mode is however explicitly run. (The assistant already ran git commit with hooks disabled, so no change there.)
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/Committer.hs29
1 files changed, 2 insertions, 27 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 695703e22..bebe6f634 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -20,9 +20,7 @@ import Assistant.Drop
import Logs.Transfer
import Logs.Location
import qualified Annex.Queue
-import qualified Git.Command
import qualified Git.LsFiles
-import qualified Git.BuildVersion
import qualified Command.Add
import Utility.ThreadScheduler
import qualified Utility.Lsof as Lsof
@@ -36,6 +34,7 @@ import Annex.CatFile
import qualified Annex
import Utility.InodeCache
import Annex.Content.Direct
+import qualified Command.Sync
import Data.Time.Clock
import Data.Tuple.Utils
@@ -217,31 +216,7 @@ commitStaged = do
v <- tryAnnex Annex.Queue.flush
case v of
Left _ -> return False
- Right _ -> do
- {- Empty commits may be made if tree changes cancel
- - each other out, etc. Git returns nonzero on those,
- - so don't propigate out commit failures. -}
- void $ inRepo $ catchMaybeIO .
- Git.Command.runQuiet
- (Param "commit" : nomessage params)
- return True
- where
- params =
- [ Param "--quiet"
- {- Avoid running the usual pre-commit hook;
- - the Watcher does the same symlink fixing,
- - and direct mode bookkeeping updating. -}
- , Param "--no-verify"
- ]
- nomessage ps
- | Git.BuildVersion.older "1.7.2" =
- Param "-m" : Param "autocommit" : ps
- | Git.BuildVersion.older "1.7.8" =
- Param "--allow-empty-message" :
- Param "-m" : Param "" : ps
- | otherwise =
- Param "--allow-empty-message" :
- Param "--no-edit" : Param "-m" : Param "" : ps
+ Right _ -> Command.Sync.commitStaged ""
{- OSX needs a short delay after a file is added before locking it down,
- when using a non-direct mode repository, as pasting a file seems to