summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-26 14:22:21 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-26 14:22:21 -0400
commit501a84985899a55e8e4fb8be71f2200c14dbae96 (patch)
treed313fd13fea6f0241aeaf0d96f7b2b07fc9699b2
parent57f324d802ef82920a1ed37875606f02a5f31f95 (diff)
git-annex-shell: Make configlist automatically initialize a remote git repository, as long as a git-annex branch has been pushed to it, to simplify setup of remote git repositories, including via gitolite.
-rw-r--r--Command/ConfigList.hs20
-rw-r--r--debian/changelog4
-rw-r--r--doc/git-annex-shell.mdwn7
3 files changed, 28 insertions, 3 deletions
diff --git a/Command/ConfigList.hs b/Command/ConfigList.hs
index 58b738864..219685c21 100644
--- a/Command/ConfigList.hs
+++ b/Command/ConfigList.hs
@@ -1,6 +1,6 @@
{- git-annex command
-
- - Copyright 2010 Joey Hess <joey@kitenet.net>
+ - Copyright 2010-2014 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -10,6 +10,8 @@ module Command.ConfigList where
import Common.Annex
import Command
import Annex.UUID
+import Annex.Init
+import qualified Annex.Branch
import qualified Git.Config
import Remote.GCrypt (coreGCryptId)
@@ -22,9 +24,23 @@ seek = withNothing start
start :: CommandStart
start = do
- u <- getUUID
+ u <- findOrGenUUID
showConfig "annex.uuid" $ fromUUID u
showConfig coreGCryptId =<< fromRepo (Git.Config.get coreGCryptId "")
stop
where
showConfig k v = liftIO $ putStrLn $ k ++ "=" ++ v
+
+{- The repository may not yet have a UUID; automatically initialize it
+ - when there's a git-annex branch available. -}
+findOrGenUUID :: Annex UUID
+findOrGenUUID = do
+ u <- getUUID
+ if u /= NoUUID
+ then return u
+ else ifM Annex.Branch.hasSibling
+ ( do
+ initialize Nothing
+ getUUID
+ , return NoUUID
+ )
diff --git a/debian/changelog b/debian/changelog
index 9cd685c93..eee5509ba 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,10 @@ git-annex (5.20140321) UNRELEASED; urgency=medium
* forget --drop-dead: Avoid removing the dead remote from the trust.log,
so that if git remotes for it still exist anywhere, git annex info
will still know it's dead and not show it.
+ * git-annex-shell: Make configlist automatically initialize
+ a remote git repository, as long as a git-annex branch has
+ been pushed to it, to simplify setup of remote git repositories,
+ including via gitolite.
-- Joey Hess <joeyh@debian.org> Fri, 21 Mar 2014 14:08:41 -0400
diff --git a/doc/git-annex-shell.mdwn b/doc/git-annex-shell.mdwn
index c866154ac..c015a7bda 100644
--- a/doc/git-annex-shell.mdwn
+++ b/doc/git-annex-shell.mdwn
@@ -26,7 +26,12 @@ first "/~/" or "/~user/" is expanded to the specified home directory.
* configlist directory
This outputs a subset of the git configuration, in the same form as
- `git config --list`
+ `git config --list`. This is used to get the annex.uuid of the remote
+ repository.
+
+ When run in a repository that does not yet have an annex.uuid, one
+ will be created, as long as a git-annex branch has already been pushed to
+ the repository.
* inannex directory [key ...]