diff --git a/Command/Describe.hs b/Command/Describe.hs index 2ad3e01ee5..453e4ebafc 100644 --- a/Command/Describe.hs +++ b/Command/Describe.hs @@ -20,7 +20,7 @@ seek :: [CommandSeek] seek = [withWords start] start :: CommandStartWords -start ws = notBareRepo $ do +start ws = do let (name, description) = case ws of (n:d) -> (n,unwords d) diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 0e3df03dd0..cb062342d7 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -64,11 +64,11 @@ verifyLocationLog key file = do case (present, u `elem` uuids) of (True, False) -> do - fix u ValuePresent + fix g u ValuePresent -- There is no data loss, so do not fail. return True (False, True) -> do - fix u ValueMissing + fix g u ValueMissing warning $ "** Based on the location log, " ++ file ++ "\n** was expected to be present, " ++ @@ -77,6 +77,6 @@ verifyLocationLog key file = do _ -> return True where - fix u s = do + fix g u s = do showNote "fixing location log" - logStatusFor u key s + logChange g key u s diff --git a/Command/Init.hs b/Command/Init.hs index df416eed36..7f5773117a 100644 --- a/Command/Init.hs +++ b/Command/Init.hs @@ -8,7 +8,7 @@ module Command.Init where import Control.Monad.State (liftIO) -import Control.Monad (when) +import Control.Monad (when, unless) import System.Directory import Command @@ -44,7 +44,8 @@ perform description = do u <- getUUID g setVersion describeUUID u description - gitPreCommitHookWrite g + unless (Git.repoIsLocalBare g) $ + gitPreCommitHookWrite g next $ return True {- set up a git pre-commit hook, if one is not already present -} diff --git a/Command/InitRemote.hs b/Command/InitRemote.hs index 67030689da..a3054630c3 100644 --- a/Command/InitRemote.hs +++ b/Command/InitRemote.hs @@ -30,7 +30,7 @@ seek :: [CommandSeek] seek = [withWords start] start :: CommandStartWords -start ws = notBareRepo $ do +start ws = do when (null ws) $ needname (u, c) <- findByName name diff --git a/Command/Move.hs b/Command/Move.hs index f49fe20e00..7fa195bab5 100644 --- a/Command/Move.hs +++ b/Command/Move.hs @@ -51,12 +51,12 @@ showAction False file = showStart "copy" file {- Used to log a change in a remote's having a key. The change is logged - in the local repo, not on the remote. The process of transferring the - key to the remote, or removing the key from it *may* log the change - - on the remote, but this cannot be relied on. For example, it's not done - - for bare repos. -} + - on the remote, but this cannot be relied on. -} remoteHasKey :: Remote.Remote Annex -> Key -> Bool -> Annex () remoteHasKey remote key present = do let remoteuuid = Remote.uuid remote - logStatusFor remoteuuid key status + g <- Annex.gitRepo + logChange g key remoteuuid status where status = if present then ValuePresent else ValueMissing diff --git a/Command/Semitrust.hs b/Command/Semitrust.hs index 11742137f1..b467861bf9 100644 --- a/Command/Semitrust.hs +++ b/Command/Semitrust.hs @@ -21,7 +21,7 @@ seek :: [CommandSeek] seek = [withWords start] start :: CommandStartWords -start ws = notBareRepo $ do +start ws = do let name = unwords ws showStart "semitrust" name u <- Remote.nameToUUID name diff --git a/Command/Trust.hs b/Command/Trust.hs index d5444affe6..41eb17ccdd 100644 --- a/Command/Trust.hs +++ b/Command/Trust.hs @@ -21,7 +21,7 @@ seek :: [CommandSeek] seek = [withWords start] start :: CommandStartWords -start ws = notBareRepo $ do +start ws = do let name = unwords ws showStart "trust" name u <- Remote.nameToUUID name diff --git a/Command/Untrust.hs b/Command/Untrust.hs index 174c395066..ea23208006 100644 --- a/Command/Untrust.hs +++ b/Command/Untrust.hs @@ -21,7 +21,7 @@ seek :: [CommandSeek] seek = [withWords start] start :: CommandStartWords -start ws = notBareRepo $ do +start ws = do let name = unwords ws showStart "untrust" name u <- Remote.nameToUUID name diff --git a/Content.hs b/Content.hs index 5d77cc9795..45653fc9e7 100644 --- a/Content.hs +++ b/Content.hs @@ -9,7 +9,6 @@ module Content ( inAnnex, calcGitLink, logStatus, - logStatusFor, getViaTmp, getViaTmpUnchecked, withTmp, @@ -27,7 +26,7 @@ import System.IO.Error (try) import System.Directory import Control.Monad.State (liftIO) import System.Path -import Control.Monad (when, unless, filterM) +import Control.Monad (when, filterM) import System.Posix.Files import System.FilePath import Data.Maybe @@ -71,16 +70,9 @@ calcGitLink file key = do - updated instead. -} logStatus :: Key -> LogStatus -> Annex () logStatus key status = do - u <- getUUID =<< Annex.gitRepo - 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 - logChange g key u status + u <- getUUID g + logChange g key u status {- Runs an action, passing it a temporary filename to download, - and if the action succeeds, moves the temp file into diff --git a/debian/changelog b/debian/changelog index 360121cbf7..a76a0534e2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,6 +2,8 @@ git-annex (0.20110611) UNRELEASED; urgency=low * New repository format, annex.version=3. Use `git annex upgrade` to migrate. + * Improved handling of bare git repos with annexes. Many more commands will + work in them. * rsync is now used when copying files from repos on other filesystems. cp is still used when copying file from repos on the same filesystem, since --reflink=auto can make it significantly faster on filesystems diff --git a/doc/bare_repositories.mdwn b/doc/bare_repositories.mdwn index 5cbad5c2d8..c5663d84cf 100644 --- a/doc/bare_repositories.mdwn +++ b/doc/bare_repositories.mdwn @@ -14,12 +14,9 @@ Known to work ok: * `git annex drop` can check that a bare repository has a copy of data that is being dropped. * `git annex get` can transfer data from a bare repository. +* Most other stuff (ie, init, describe, trust, etc.) There are a few caveats to keep in mind when using bare repositories: -* Some subcommands, like `fsck`, `trust`, `unused` and `fromkey`, - cannot be run in a bare repository. Those subcommands will - refuse to do anything. -* `git annex setkey` is a plumbing-level command; using it manually - to add content to a bare repository is not recommended, since there - will be no record that the content is stored there. +* A few subcommands, like `unused` cannot be run in a bare repository. + Those subcommands will refuse to do anything.