versioncontrol

package
v0.0.0-...-6e28e11 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 8 Imported by: 11

Documentation

Overview

Package versioncontrol is a simplified/stripped down version of go/internal/get/vcs that is aimed at the simplier temporary git clone needed for OpenFaaS template fetch.

Index

Constants

This section is empty.

Variables

View Source
var GitCheckRefName = &vcsCmd{
	name:   "Git",
	cmd:    "git",
	cmds:   []string{"check-ref-format --allow-onelevel {refname}"},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitCheckRefName defines the command that validates if a string is a valid reference name or sha

View Source
var GitCheckout = &vcsCmd{
	name:   "Git",
	cmd:    "git",
	cmds:   []string{"-C {dir} checkout {refname}"},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitCheckout checks out a specific REF of a repo into a directory

View Source
var GitCloneBranch = &vcsCmd{
	name:   "Git",
	cmd:    "git",
	cmds:   []string{"clone {repo} {dir} --depth=1 --config core.autocrlf=false -b {refname}"},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitCloneBranch clones a specific branch of a repo into a directory

View Source
var GitCloneDefault = &vcsCmd{
	name:   "Git",
	cmd:    "git",
	cmds:   []string{"clone {repo} {dir} --depth=1 --config core.autocrlf=false"},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitCloneDefault clones the default branch of a repo into a directory

View Source
var GitCloneFullDepth = &vcsCmd{
	name:   "Git",
	cmd:    "git",
	cmds:   []string{"clone {repo} {dir} --config core.autocrlf=false"},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitCloneFullDepth clones a repo into a directory with full depth so that a SHA can be checked out after

View Source
var GitInitRepo2_28_0 = &vcsCmd{
	name: "Git",
	cmd:  "git",
	cmds: []string{
		"init {dir} --initial-branch=master",
		"config core.autocrlf false",
		"config user.email \"contact@openfaas.com\"",
		"config user.name \"OpenFaaS\"",
		"add {dir}",
		"commit -m \"Test-commit\"",
	},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

GitInitRepo initializes the working directory add commit all files & directories for Git 2.28.0+

View Source
var GitInitRepoClassic = &vcsCmd{
	name: "Git",
	cmd:  "git",
	cmds: []string{
		"init {dir}",
		"config core.autocrlf false",
		"config user.email \"contact@openfaas.com\"",
		"config user.name \"OpenFaaS\"",
		"add {dir}",
		"commit -m \"Test-commit\"",
	},
	scheme: []string{"git", "https", "http", "git+ssh", "ssh"},
}

Functions

func GetGitBranch

func GetGitBranch() string

func GetGitDescribe

func GetGitDescribe() string

GetGitDescribe returns the human readable name for the current commit using `git-describe`

func GetGitSHA

func GetGitSHA() string

GetGitSHA returns the short Git commit SHA from local repo

func GetGitSHAFor

func GetGitSHAFor(path string, short bool) (string, error)

GetGitSHA returns the short Git commit SHA from local repo

func IsGitRemote

func IsGitRemote(repoURL string) bool

IsGitRemote validates if the supplied string is a valid git remote url value

func IsPinnedGitRemote

func IsPinnedGitRemote(repoURL string) bool

IsPinnedGitRemote validates if the supplied string is a valid git remote url value

func ParsePinnedRemote

func ParsePinnedRemote(repoURL string) (remoteURL, refName string)

ParsePinnedRemote returns the remote url and contraint value from repository url

Types

This section is empty.

Jump to

Keyboard shortcuts

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