summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-03 16:40:55 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-03 16:40:55 -0400
commitb5b78f26ecabdb74c05f8200de5f9d054da5cbae (patch)
treec7a914c0799a1606774a4653456b9033174e4d35
parentb88637fff10d4d845404882e4ec95cfc071dcac0 (diff)
fix up commands that are trouble on bare repos
Most will just abort. init does a basic init and gives a command to run elsewhere to finish it.
-rw-r--r--Command/DropUnused.hs2
-rw-r--r--Command/FromKey.hs3
-rw-r--r--Command/Fsck.hs2
-rw-r--r--Command/Init.hs16
-rw-r--r--Command/Unused.hs2
-rw-r--r--debian/changelog3
-rw-r--r--doc/bare_repositories.mdwn25
-rw-r--r--doc/index.mdwn1
8 files changed, 31 insertions, 23 deletions
diff --git a/Command/DropUnused.hs b/Command/DropUnused.hs
index 63216ce4f..594564cb7 100644
--- a/Command/DropUnused.hs
+++ b/Command/DropUnused.hs
@@ -29,7 +29,7 @@ seek = [withStrings start]
{- Drops unused content by number. -}
start :: CommandStartString
-start s = do
+start s = notBareRepo $ do
m <- readUnusedLog
case M.lookup s m of
Nothing -> return Nothing
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index d16eff846..717d528bc 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -27,9 +27,8 @@ command = [Command "fromkey" paramPath seek
seek :: [CommandSeek]
seek = [withFilesMissing start]
-{- Adds a file pointing at a manually-specified key -}
start :: CommandStartString
-start file = do
+start file = notBareRepo $ do
key <- cmdlineKey
inbackend <- Backend.hasKey key
unless inbackend $ error $
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index f8c957053..76d0e38b4 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -27,7 +27,7 @@ seek :: [CommandSeek]
seek = [withAttrFilesInGit "annex.numcopies" start]
start :: CommandStartAttrFile
-start (file, attr) = isAnnexed file $ \(key, backend) -> do
+start (file, attr) = notBareRepo $ isAnnexed file $ \(key, backend) -> do
showStart "fsck" file
return $ Just $ perform key file backend numcopies
where
diff --git a/Command/Init.hs b/Command/Init.hs
index 1074d100e..509c9e51c 100644
--- a/Command/Init.hs
+++ b/Command/Init.hs
@@ -41,11 +41,19 @@ perform :: String -> CommandPerform
perform description = do
g <- Annex.gitRepo
u <- getUUID g
- describeUUID u description
setVersion
- liftIO $ gitAttributesWrite g
- gitPreCommitHookWrite g
- return $ Just cleanup
+ if Git.repoIsLocalBare g
+ then do
+ showLongNote $
+ "This is a bare repository, so its description cannot be committed.\n" ++
+ "To record the description, run this command in a clone of this repository:\n" ++
+ " git annex describe " ++ (show u) ++ " '" ++ description ++ "'\n\n"
+ return $ Just $ return True
+ else do
+ describeUUID u description
+ liftIO $ gitAttributesWrite g
+ gitPreCommitHookWrite g
+ return $ Just cleanup
cleanup :: CommandCleanup
cleanup = do
diff --git a/Command/Unused.hs b/Command/Unused.hs
index 67a227237..9f3881d59 100644
--- a/Command/Unused.hs
+++ b/Command/Unused.hs
@@ -32,7 +32,7 @@ seek = [withNothing start]
{- Finds unused content in the annex. -}
start :: CommandStartNothing
-start = do
+start = notBareRepo $ do
showStart "unused" ""
return $ Just perform
diff --git a/debian/changelog b/debian/changelog
index 3d96934a5..4405ee2a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,7 +11,8 @@ git-annex (0.22) UNRELEASED; urgency=low
* New backends: SHA512 SHA384 SHA256 SHA224
* fsck: Check for and repair location log damage.
* Git annexes can now be attached to bare git repositories. Due to popular
- demand.
+ demand. Both the local and remote host must have this version of git-annex
+ installed for it to work.
-- Joey Hess <joeyh@debian.org> Sun, 13 Feb 2011 00:48:02 -0400
diff --git a/doc/bare_repositories.mdwn b/doc/bare_repositories.mdwn
index e3c82d019..b7ae0b316 100644
--- a/doc/bare_repositories.mdwn
+++ b/doc/bare_repositories.mdwn
@@ -1,13 +1,13 @@
+**This is still an experimental feature!** Use with caution.
+
Due to popular demand, git-annex can now be used with bare repositories.
So, for example, you can stash a file away in your
repos's origin: `git annex move mybigfile --to origin`
Of course, for that to work, the bare repository has to be on a system with
-[[git-annex-shell]] installed. If "origin" is on gitweb, you still can't
-use git-annex to there.
-
-**This is still an experimental feature!**
+[[git-annex-shell]] installed. If "origin" is on GitWeb, you still can't
+use git-annex to store stuff there.
Known to work ok:
@@ -17,16 +17,15 @@ Known to work ok:
that is being dropped.
* `git annex get` can transfer data from a bare repository.
-There are a few caveats to keep in mind:
+There are a few caveats to keep in mind when using bare repositories:
* `git annex init` can be run in a bare repository, but it cannot
store the name you gave the repository in .git-annex/uuid.log (because
- the bare repository has no such file to commit to).
-* `git annex fromkey` does something pointless in a bare repository.
-* `git annex fsck` cannot detect any problems in a bare repository.
-* `git annex unused` will think everything stored in a bare repository
- is unused.
-* `git annex setkey` is a plumbing-level command, and using it manually
+ the bare repository has no such file to commit to). Instead, it will
+ tell you a command to run in some non-bare clone of the repository.
+* 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 accessible by other repositories that the content
- is stored there.
+ will be no record that the content is stored there.
diff --git a/doc/index.mdwn b/doc/index.mdwn
index a6d072e09..00a3315cb 100644
--- a/doc/index.mdwn
+++ b/doc/index.mdwn
@@ -54,6 +54,7 @@ files with git.
* git-annex prevents accidental data loss by [[tracking copies|copies]]
of your files
* [[internals]]
+* [[bare_repositories]]
* [[what git annex is not|not]]
* git-annex is Free Software, licensed under the [[GPL]].