summaryrefslogtreecommitdiff
path: root/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-03 15:22:53 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-03 15:22:53 -0400
commit9f20aee2192bcc5f2c0ae1f59db88f6eadeb7335 (patch)
treea35b490222a98f9f22ba65613ac9a051a8681ea7 /Content.hs
parentd25a8540854fed30567868799322bbdf4e947c2f (diff)
avoid logging to location log when in a bare repo
This assumes that changes to content in bare repos are made from some non-bare repo, and that the location log is updated on that side. That's true for move --from and move --to. It's *not* true for dropkey and setkey and recvkey. But those are plumbing level commands, so I guess it's ok to assume that someone running those in a bare repo knows what they're doing. And git-annex-shell is used to run those, and if the bare repo is non-local, it needs to be able to use them even though they cannot update the location log. So this seems unavoidable.
Diffstat (limited to 'Content.hs')
-rw-r--r--Content.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/Content.hs b/Content.hs
index 658d9a861..6b8316c08 100644
--- a/Content.hs
+++ b/Content.hs
@@ -23,7 +23,7 @@ import System.IO.Error (try)
import System.Directory
import Control.Monad.State (liftIO)
import System.Path
-import Control.Monad (when, filterM)
+import Control.Monad (when, unless, filterM)
import System.Posix.Files
import System.FilePath
@@ -54,13 +54,19 @@ calcGitLink file key = do
return $ relPathDirToDir (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.
+ -
+ - Note that the LocationLog is not updated in bare repositories.
+ - Operations that change a bare repository should be done from
+ - a non-bare repository, and the LocationLog in that repository be
+ - updated instead. -}
logStatus :: Key -> LogStatus -> Annex ()
logStatus key status = do
g <- Annex.gitRepo
- u <- getUUID g
- logfile <- liftIO $ logChange g key u status
- Annex.queue "add" [Param "--"] logfile
+ unless (Git.repoIsLocalBare g) $ do
+ u <- getUUID g
+ logfile <- liftIO $ logChange g key u status
+ Annex.queue "add" [Param "--"] logfile
{- Runs an action, passing it a temporary filename to download,
- and if the action succeeds, moves the temp file into