c5b8484c2e
Now it suffices to run git remote add, followed by git-annex sync. Now the remote is automatically initialized for use by git-annex, where before the git-annex branch had to manually be pushed before using git-annex sync. Note that this involved changes to git-annex-shell, so if the remote is using an old version, the manual push is still needed. Implementation required git-annex-shell be changed, so configlist can autoinit a repository even when no git-annex branch has been pushed yet. Unfortunate because we'll have to wait for it to get deployed to servers before being able to rely on this change in the documentation. Did consider making git-annex sync push the git-annex branch to repos that didn't have a uuid, but this seemed difficult to do without complicating it in messy ways. It would be cleaner to split a command out from configlist to handle the initialization. But this is difficult without sacrificing backwards compatability, for users of old git-annex versions which would not use the new command.
39 lines
897 B
Haskell
39 lines
897 B
Haskell
{- git-annex-shell fields
|
|
-
|
|
- Copyright 2012 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
-}
|
|
|
|
module CmdLine.GitAnnexShell.Fields where
|
|
|
|
import Common.Annex
|
|
import qualified Annex
|
|
import Git.FilePath
|
|
|
|
import Data.Char
|
|
|
|
{- A field, stored in Annex state, with a value sanity checker. -}
|
|
data Field = Field
|
|
{ fieldName :: String
|
|
, fieldCheck :: String -> Bool
|
|
}
|
|
|
|
getField :: Field -> Annex (Maybe String)
|
|
getField = Annex.getField . fieldName
|
|
|
|
remoteUUID :: Field
|
|
remoteUUID = Field "remoteuuid" $
|
|
-- does it look like a UUID?
|
|
all (\c -> isAlphaNum c || c == '-')
|
|
|
|
associatedFile :: Field
|
|
associatedFile = Field "associatedfile" $ \f ->
|
|
-- is the file a safe relative filename?
|
|
not (absoluteGitPath f) && not ("../" `isPrefixOf` f)
|
|
|
|
direct :: Field
|
|
direct = Field "direct" $ \f -> f == "1"
|
|
|
|
autoInit :: Field
|
|
autoInit = Field "autoinit" $ \f -> f == "1"
|