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.
This commit is contained in:
parent
cb7574ce10
commit
72978a8de0
3 changed files with 28 additions and 3 deletions
|
@ -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
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue