config

package
v4.0.0-rc5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package config storage is the implementation of git config for go-git

Index

Constants

View Source
const (
	// DefaultRefSpec is the default refspec used, when none is given
	DefaultRefSpec = "+refs/heads/*:refs/remotes/%s/*"
)

Variables

View Source
var (
	ErrInvalid               = errors.New("config invalid remote")
	ErrRemoteConfigNotFound  = errors.New("remote config not found")
	ErrRemoteConfigEmptyURL  = errors.New("remote config: empty URL")
	ErrRemoteConfigEmptyName = errors.New("remote config: empty name")
)

Functions

func MatchAny

func MatchAny(l []RefSpec, n plumbing.ReferenceName) bool

MatchAny returns true if any of the RefSpec match with the given ReferenceName

Types

type Config

type Config struct {
	Core struct {
		IsBare bool
	}
	Remotes map[string]*RemoteConfig
}

Config contains the repository configuration

func NewConfig

func NewConfig() *Config

NewConfig returns a new empty Config

func (*Config) Validate

func (c *Config) Validate() error

Validate validate the fields and set the default values

type ConfigStorer

type ConfigStorer interface {
	Config() (*Config, error)
	SetConfig(*Config) error
}

ConfigStorer generic storage of Config object

type RefSpec

type RefSpec string

RefSpec is a mapping from local branches to remote references The format of the refspec is an optional +, followed by <src>:<dst>, where <src> is the pattern for references on the remote side and <dst> is where those references will be written locally. The + tells Git to update the reference even if it isn’t a fast-forward. eg.: "+refs/heads/*:refs/remotes/origin/*"

https://git-scm.com/book/es/v2/Git-Internals-The-Refspec

func (RefSpec) Dst

Dst returns the destination for the given remote reference

func (RefSpec) IsDelete

func (s RefSpec) IsDelete() bool

IsDelete returns true if the refspec indicates a delete (empty src).

func (RefSpec) IsForceUpdate

func (s RefSpec) IsForceUpdate() bool

IsForceUpdate returns if update is allowed in non fast-forward merges

func (RefSpec) IsValid

func (s RefSpec) IsValid() bool

IsValid validates the RefSpec

func (RefSpec) IsWildcard

func (s RefSpec) IsWildcard() bool

IsWildcard returns true if the RefSpec contains a wildcard

func (RefSpec) Match

func (s RefSpec) Match(n plumbing.ReferenceName) bool

Match match the given plumbing.ReferenceName against the source

func (RefSpec) Src

func (s RefSpec) Src() string

Src return the src side

func (RefSpec) String

func (s RefSpec) String() string

type RemoteConfig

type RemoteConfig struct {
	Name  string
	URL   string
	Fetch []RefSpec
}

RemoteConfig contains the configuration for a given repository

func (*RemoteConfig) Validate

func (c *RemoteConfig) Validate() error

Validate validate the fields and set the default values

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL