diff --git a/Command/ConfigList.hs b/Command/ConfigList.hs index 58b7388645..219685c21c 100644 --- a/Command/ConfigList.hs +++ b/Command/ConfigList.hs @@ -1,6 +1,6 @@ {- git-annex command - - - Copyright 2010 Joey Hess + - Copyright 2010-2014 Joey Hess - - 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 9cd685c934..eee5509bac 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 Fri, 21 Mar 2014 14:08:41 -0400 diff --git a/doc/git-annex-shell.mdwn b/doc/git-annex-shell.mdwn index c866154acb..c015a7bda8 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 ...]