Avoid using absolute paths when staging location log, as that can confuse git when a remote's path contains a symlink. Closes: #621386

This was a real PITA to fix, since location logs can be staged in
both the current repo, as well as in local remote's repos, in
which case the cwd will not be in the repo. And git add needs different
params in both cases, when absolute paths are not used.

In passing, git annex fsck now stages location log fixes.
This commit is contained in:
Joey Hess 2011-04-25 14:54:24 -04:00
parent e433c6f0bb
commit 76911a446a
5 changed files with 43 additions and 27 deletions

View file

@ -64,11 +64,11 @@ verifyLocationLog key file = do
case (present, u `elem` uuids) of
(True, False) -> do
fix g u ValuePresent
fix u ValuePresent
-- There is no data loss, so do not fail.
return True
(False, True) -> do
fix g u ValueMissing
fix u ValueMissing
warning $
"** Based on the location log, " ++ file
++ "\n** was expected to be present, " ++
@ -77,7 +77,6 @@ verifyLocationLog key file = do
_ -> return True
where
fix g u s = do
fix u s = do
showNote "fixing location log"
_ <- liftIO $ logChange g key u s
return ()
logStatusFor u key s

View file

@ -7,19 +7,15 @@
module Command.Move where
import Control.Monad.State (liftIO)
import Command
import qualified Command.Drop
import qualified Annex
import qualified AnnexQueue
import LocationLog
import Types
import Content
import qualified Remote
import UUID
import Messages
import Utility
command :: [Command]
command = [repoCommand "move" paramPath seek
@ -57,10 +53,8 @@ showAction False file = showStart "copy" file
- for bare repos. -}
remoteHasKey :: Remote.Remote Annex -> Key -> Bool -> Annex ()
remoteHasKey remote key present = do
g <- Annex.gitRepo
let remoteuuid = Remote.uuid remote
logfile <- liftIO $ logChange g key remoteuuid status
AnnexQueue.add "add" [Param "--"] logfile
logStatusFor remoteuuid key status
where
status = if present then ValuePresent else ValueMissing