commit git-annex branch when copying to a remote (locally)

Otherwise, the location log changes are only staged in its index,
and this can confuse matters if pulling or cloning from the remote.

The test suite was failing because this wasn't done.
This commit is contained in:
Joey Hess 2011-06-22 21:19:52 -04:00
parent c0fbd3017f
commit c4e6730042
3 changed files with 13 additions and 8 deletions

View file

@ -19,7 +19,7 @@ import Control.Monad (when)
import qualified Annex import qualified Annex
import qualified AnnexQueue import qualified AnnexQueue
import qualified GitRepo as Git import qualified GitRepo as Git
import qualified Branch import Content
import Types import Types
import Command import Command
import BackendList import BackendList
@ -103,9 +103,6 @@ startup = do
{- Cleanup actions. -} {- Cleanup actions. -}
shutdown :: Annex Bool shutdown :: Annex Bool
shutdown = do shutdown = do
AnnexQueue.flush False saveState
Branch.commit "update"
liftIO $ Git.reap liftIO $ Git.reap
return True return True

View file

@ -19,7 +19,8 @@ module Content (
removeAnnex, removeAnnex,
fromAnnex, fromAnnex,
moveBad, moveBad,
getKeysPresent getKeysPresent,
saveState
) where ) where
import System.IO.Error (try) import System.IO.Error (try)
@ -37,6 +38,8 @@ import LocationLog
import UUID import UUID
import qualified GitRepo as Git import qualified GitRepo as Git
import qualified Annex import qualified Annex
import qualified AnnexQueue
import qualified Branch
import Utility import Utility
import StatFS import StatFS
import Types.Key import Types.Key
@ -263,3 +266,9 @@ getKeysPresent' dir = do
case result of case result of
Right s -> return $ isRegularFile s Right s -> return $ isRegularFile s
Left _ -> return False Left _ -> return False
{- Things to do to record changes to content. -}
saveState :: Annex ()
saveState = do
AnnexQueue.flush False
Branch.commit "update"

View file

@ -17,7 +17,6 @@ import Types
import Types.Remote import Types.Remote
import qualified GitRepo as Git import qualified GitRepo as Git
import qualified Annex import qualified Annex
import qualified AnnexQueue
import Locations import Locations
import UUID import UUID
import Utility import Utility
@ -147,7 +146,7 @@ copyToRemote r key
Annex.eval a $ do Annex.eval a $ do
ok <- Content.getViaTmp key $ ok <- Content.getViaTmp key $
rsyncOrCopyFile r keysrc rsyncOrCopyFile r keysrc
AnnexQueue.flush True Content.saveState
return ok return ok
| Git.repoIsSsh r = do | Git.repoIsSsh r = do
g <- Annex.gitRepo g <- Annex.gitRepo