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.)
This commit is contained in:
Joey Hess 2013-12-01 13:59:39 -04:00
parent 4f4dba50cb
commit 03932212ec
9 changed files with 95 additions and 73 deletions

View file

@ -10,6 +10,7 @@ module Git.Ref where
import Common
import Git
import Git.Command
import Git.Sha
import Data.Char (chr)
@ -105,6 +106,11 @@ matchingUniq refs repo = nubBy uniqref <$> matching refs repo
where
uniqref (a, _) (b, _) = a == b
{- Gets the sha of the tree a ref uses. -}
tree :: Ref -> Repo -> IO (Maybe Sha)
tree ref = extractSha <$$> pipeReadStrict
[ Param "rev-parse", Param (show ref ++ ":") ]
{- Checks if a String is a legal git ref name.
-
- The rules for this are complex; see git-check-ref-format(1) -}