Documentation ¶
Overview ¶
Package config provides global variables, macros, environments and settings.
Index ¶
- Constants
- Variables
- func AssumeNo() bool
- func AssumeYes() bool
- func CheckGitAlias()
- func GetConfigDir() (string, error)
- func GetLogFile() string
- func GetLogLevel() string
- func GetLogRotateSize() int64
- func GetMockSSHInfoResponse() string
- func GetMockSSHInfoStatus() int
- func GetQuiet() bool
- func GetRepoHooksDir() (string, error)
- func GetVerbose() int
- func InstallExtraGitConfig() error
- func InstallRepoConfig() error
- func InstallRepoHooks() error
- func IsDryRun() bool
- func IsSingleMode() bool
- func MockNoSymlink() bool
- func MockNoTTY() bool
- func MockUploadOptionsEditScript() string
- func NoCertChecks() bool
- type CodeReview
- type GitURL
- type UploadOptions
Constants ¶
const ( GIT = "git" DefaultConfigDir = ".git-repo" DefaultLogRotate = 20 * 1024 * 1024 DefaultLogLevel = "warn" CfgRepoArchive = "repo.archive" CfgRepoDepth = "repo.depth" CfgRepoDissociate = "repo.dissociate" CfgRepoMirror = "repo.mirror" CfgRepoReference = "repo.reference" CfgRepoSubmodules = "repo.submodules" CfgManifestGroups = "manifest.groups" CfgManifestName = "manifest.name" CfgRemoteOriginURL = "remote.origin.url" CfgBranchDefaultMerge = "branch.default.merge" CfgManifestRemoteSSHInfo = "manifest.remote.%s.sshinfo" CfgManifestRemoteExpire = "manifest.remote.%s.expire" CfgAppGitRepoDisabled = "app.git.repo.disabled" ManifestsDotGit = "manifests.git" Manifests = "manifests" DefaultXML = "default.xml" ManifestXML = "manifest.xml" LocalManifestXML = "local_manifest.xml" LocalManifests = "local_manifests" ProjectObjects = "project-objects" Projects = "projects" RefsHeads = "refs/heads/" RefsTags = "refs/tags/" RefsPub = "refs/published/" Refs = "refs/" RefsRemotes = "refs/remotes/" MaxJobs = 32 ViperEnvPrefix = "GIT_REPO" )
Exported macros
const (
// DefaultGitRepoConfigFile is default git-repo config file
DefaultGitRepoConfigFile = "config"
)
Variables ¶
var ( // DotRepo is '.repo', admin directory for git-repo DotRepo = path.DotRepo // CommitIDPattern indicates raw commit ID CommitIDPattern = regexp.MustCompile(`^[0-9a-f]{40}([0-9a-f]{24})?$`) // GitDefaultConfig is git global and system config. GitDefaultConfig goconfig.GitConfig )
var ( // GitHTTPProtocolPattern indicates git over HTTP protocol GitHTTPProtocolPattern = regexp.MustCompile(`^(?P<proto>http|https)://((?P<user>.*?)@)?(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.*?)(\.git)?/?)?$`) // GitSSHProtocolPattern indicates git over SSH protocol GitSSHProtocolPattern = regexp.MustCompile(`^(?P<proto>ssh)://((?P<user>.*?)@)?(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.+?)(\.git)?)?/?$`) // GitSCPProtocolPattern indicates scp-style git over SSH protocol GitSCPProtocolPattern = regexp.MustCompile(`^((?P<user>.*?)@)?(?P<host>[^/:]+?):(?P<repo>.*?)(\.git)?/?$`) // GitDaemonProtocolPattern indicates git over git-daemon protocol GitDaemonProtocolPattern = regexp.MustCompile(`^(?P<proto>git)://(?P<host>[^/]+?)(:(?P<port>[0-9]+))?(/(?P<repo>.*?)(\.git)?/?)?$`) // GitFileProtocolPattern indicates git over file protocol GitFileProtocolPattern = regexp.MustCompile(`^(?:(?P<proto>file)://)?(/(?P<repo>.*?)/?)?$`) )
var ( // GerritHooks defines map of Gerrit hooks. GerritHooks = map[string]string{ "commit-msg": gerritCommitMsgHook, } )
var ( // PGPKeyRing for verify git-repo package PGPKeyRing = map[string]string{ "Jiang Xin": pubkey1, "Alibaba": pubkey2, } )
Functions ¶
func CheckGitAlias ¶
func CheckGitAlias()
CheckGitAlias checks if any alias command has been overridden.
func GetLogRotateSize ¶
func GetLogRotateSize() int64
GetLogRotateSize gets logrotate size from config.
func GetMockSSHInfoResponse ¶
func GetMockSSHInfoResponse() string
GetMockSSHInfoResponse gets --mock-ssh-info-response option.
func GetMockSSHInfoStatus ¶
func GetMockSSHInfoStatus() int
GetMockSSHInfoStatus gets --mock-ssh-info-status option.
func GetRepoHooksDir ¶
GetRepoHooksDir returns the hooks template dir for git-repo.
func InstallExtraGitConfig ¶
func InstallExtraGitConfig() error
InstallExtraGitConfig installs extra git config file if necessary.
func InstallRepoConfig ¶
func InstallRepoConfig() error
InstallRepoConfig installs default git-repo config example file.
func InstallRepoHooks ¶
func InstallRepoHooks() error
InstallRepoHooks installs hooks into ~/.git-repo/hooks.
func MockUploadOptionsEditScript ¶
func MockUploadOptionsEditScript() string
MockUploadOptionsEditScript gets --mock-upload-options-edit-script option.
Types ¶
type CodeReview ¶ added in v0.7.7
CodeReview to be updated.
func (CodeReview) Empty ¶ added in v0.7.7
func (v CodeReview) Empty() bool
Empty checks if CodeReview is empty.
type GitURL ¶
GitURL holds Git URL.
func ParseGitURL ¶
ParseGitURL parses address and returns GitURL.
func (GitURL) GetRootURL ¶
GetRootURL returns root URL, can be used for review.
type UploadOptions ¶ added in v0.7.7
type UploadOptions struct { AutoTopic bool CodeReview CodeReview // Directly edit remote code review. Description string DestBranch string // Target branch for code review. Draft bool Issue string LocalBranch string // Local branch with commits, will push to remote. MockGitPush bool NoCertChecks bool NoEmails bool OldOid string People [][]string Private bool PushOptions []string RemoteName string RemoteURL string Title string WIP bool }
UploadOptions is options for upload related methods.