gitutil

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 4 Imported by: 20

Documentation

Index

Constants

View Source
const (
	HTTPProtocol = iota + 1
	HTTPSProtocol
	SSHProtocol
	GitProtocol
	UnknownProtocol
)

Variables

This section is empty.

Functions

func ParseProtocol

func ParseProtocol(remote string) (string, int)

ParseProtocol parses a git URL and returns the remote url and protocol type

Types

type GitRef added in v0.11.0

type GitRef struct {
	// Remote is the remote repository path.
	Remote string

	// ShortName is the directory name of the repo.
	// e.g., "bar" for "https://github.com/foo/bar.git"
	ShortName string

	// Commit is a commit hash, a tag, or branch name.
	// Commit is optional.
	Commit string

	// SubDir is a directory path inside the repo.
	// SubDir is optional.
	SubDir string

	// IndistinguishableFromLocal is true for a ref that is indistinguishable from a local file path,
	// e.g., "github.com/foo/bar".
	//
	// Deprecated.
	// Instead, use a distinguishable form such as "https://github.com/foo/bar.git".
	//
	// The dockerfile frontend still accepts this form only for build contexts.
	IndistinguishableFromLocal bool

	// UnencryptedTCP is true for a ref that needs an unencrypted TCP connection,
	// e.g., "git://..." and "http://..." .
	//
	// Discouraged, although not deprecated.
	// Instead, consider using an encrypted TCP connection such as "git@github.com/foo/bar.git" or "https://github.com/foo/bar.git".
	UnencryptedTCP bool
}

GitRef represents a git ref.

Examples:

func ParseGitRef added in v0.11.0

func ParseGitRef(ref string) (*GitRef, error)

ParseGitRef parses a git ref.

Jump to

Keyboard shortcuts

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