git

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2016 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile added in v1.1.1

func ParseFile(source string) (details *FileProtoDetails, mods *URLMods)

ParseFile will see if the input string is a valid file location, where file names have a great deal of flexibility and can even match expect git clone spec syntax; it also provides details if the file:// proto was explicitly specified, if we should use OS copy vs. the git binary, and if a frag/ref has a bad format

func ParseURL added in v1.1.1

func ParseURL(source string) (*url.URL, error)

ParseURL sees if the spec is properly handled by golang's URL parser, with a valid, explicit protocol specified, and deals with some of the known issues we have seen with the logic

Types

type Clone

type Clone struct {
	Git
	util.FileSystem
}

func (*Clone) Download

func (c *Clone) Download(config *api.Config) (*api.SourceInfo, error)

Download downloads the application source code from the GIT repository and checkout the Ref specified in the config.

type FileProtoDetails added in v1.1.1

type FileProtoDetails struct {
	// Using the clone spec as a literal file path, does it actually exis
	FileExists bool
	// Use OS level file copy commands instead of the git binary
	UseCopy bool
	// Did the clone spec have the prefix of file://
	ProtoSpecified bool
	// Was the text for a fragment/ref that follows the last # incorrect
	BadRef bool
}

FileProtoDetails encapsulates certain determinations from examining a given clone spec under the assumption that it is a local file protocol clone spec

type Git

type Git interface {
	ValidCloneSpec(source string) bool
	ValidCloneSpecRemoteOnly(source string) bool
	MungeNoProtocolURL(source string, url *url.URL) error
	Clone(source, target string, opts api.CloneConfig) error
	Checkout(repo, ref string) error
	SubmoduleUpdate(repo string, init, recursive bool) error
	GetInfo(string) *api.SourceInfo
}

Git is an interface used by main STI code to extract/checkout git repositories

func New

func New() Git

New returns a new instance of the default implementation of the Git interface

type URLMods added in v1.1.1

type URLMods struct {
	Scheme string
	User   string
	Host   string
	Path   string
	// Corresponds to Fragment in the URL struct, but we use Ref since URL Fragments are used and git commit refs
	Ref string
}

URLMods encapsulates potential changes to similarly named fields in the URL struct defined in golang when a protocol is not explicitly specified in a clone spec (which is possible for certain file:// and ssh:// permutations)

func ParseSSH added in v1.1.1

func ParseSSH(source string) (*URLMods, error)

ParseSSH will see if the input string is a valid git clone spec which follows the rules for using the ssh protocol either with or without the ssh:// prefix

Jump to

Keyboard shortcuts

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