diff --git a/Command/Lock.hs b/Command/Lock.hs index 1ae4882272..e21792143a 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 diff --git a/debian/changelog b/debian/changelog index 13b53280b4..783496614f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,9 @@ git-annex (0.20110523) UNRELEASED; urgency=low * Minor bugfixes and error message improvements. + * 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. -- Joey Hess Sat, 28 May 2011 22:29:37 -0400