diff options
author | Joey Hess <joey@kitenet.net> | 2011-05-31 14:50:41 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-05-31 14:50:41 -0400 |
commit | fafe60768f98ed33b8aae6cba147a15a6608eaaf (patch) | |
tree | f7ef3fe00f577e6d828653fb5e49d601860f5642 /Command/Lock.hs | |
parent | 6e6e77f9c05fe67a047e93b93bc198e6d9f431ce (diff) |
Massively sped up `git annex lock` by avoiding use of the uber-slow `git reset`, and only running `git checkout` once, even when many files are being locked.
Diffstat (limited to 'Command/Lock.hs')
-rw-r--r-- | Command/Lock.hs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Command/Lock.hs b/Command/Lock.hs index 1ae488227..e21792143 100644 --- a/Command/Lock.hs +++ b/Command/Lock.hs @@ -12,8 +12,7 @@ import System.Directory import Command import Messages -import qualified Annex -import qualified GitRepo as Git +import qualified AnnexQueue import Utility command :: [Command] @@ -31,9 +30,8 @@ start (file, _) = do perform :: FilePath -> CommandPerform perform file = do liftIO $ removeFile file - g <- Annex.gitRepo - -- first reset the file to drop any changes checked into the index - liftIO $ Git.run g "reset" [Params "-q --", File file] - -- checkout the symlink - liftIO $ Git.run g "checkout" [Param "--", File file] + -- Checkout from HEAD to get rid of any changes that might be + -- staged in the index, and get back to the previous symlink to + -- the content. + AnnexQueue.add "checkout" [Param "HEAD", Param "--"] file next $ return True -- no cleanup needed |