diff options
author | Joey Hess <joey@kitenet.net> | 2011-04-25 14:54:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-04-25 14:54:24 -0400 |
commit | 76911a446a7156ffb23679c6325fa8aab1edce13 (patch) | |
tree | 8b4915fe5d33a7df38275afc58161102b5033fd7 /Content.hs | |
parent | e433c6f0bb2ee5f03217b85e3b677b961f5d391a (diff) |
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.
Diffstat (limited to 'Content.hs')
-rw-r--r-- | Content.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Content.hs b/Content.hs index 576eecb31..bf9456221 100644 --- a/Content.hs +++ b/Content.hs @@ -9,6 +9,7 @@ module Content ( inAnnex, calcGitLink, logStatus, + logStatusFor, getViaTmp, getViaTmpUnchecked, checkDiskSpace, @@ -61,7 +62,8 @@ calcGitLink file key = do return $ relPathDirToFile (parentDir absfile) (Git.workTree g) </> ".git" </> annexLocation key -{- Updates the LocationLog when a key's presence changes. +{- Updates the LocationLog when a key's presence changes in the current + - repository. - - Note that the LocationLog is not updated in bare repositories. - Operations that change a bare repository should be done from @@ -70,10 +72,18 @@ calcGitLink file key = do logStatus :: Key -> LogStatus -> Annex () logStatus key status = do g <- Annex.gitRepo + u <- getUUID g + logStatusFor u key status + +{- Updates the LocationLog when a key's presence changes in a repository + - identified by UUID. -} +logStatusFor :: UUID -> Key -> LogStatus -> Annex () +logStatusFor u key status = do + g <- Annex.gitRepo unless (Git.repoIsLocalBare g) $ do - u <- getUUID g logfile <- liftIO $ logChange g key u status - AnnexQueue.add "add" [Param "--"] logfile + rellogfile <- liftIO $ Git.workTreeFile g logfile + AnnexQueue.add "add" [Param "--"] rellogfile {- Runs an action, passing it a temporary filename to download, - and if the action succeeds, moves the temp file into |