faas-cli: github.com/openfaas/faas-cli/versioncontrol Index | Files

package versioncontrol

import "github.com/openfaas/faas-cli/versioncontrol"

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

Package Files

core.go git.go parse.go

Variables

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

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

GitCheckout defines the command to clone a repo into a directory

var GitClone = &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"},
}

GitClone defines the command to clone a repo into a directory

var GitInitRepo = &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"},
}

GitInitRepo initializes the working directory add commit all files & directories

func GetGitBranch Uses

func GetGitBranch() string

func GetGitDescribe Uses

func GetGitDescribe() string

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

func GetGitSHA Uses

func GetGitSHA() string

GetGitSHA returns the short Git commit SHA from local repo

func IsGitRemote Uses

func IsGitRemote(repoURL string) bool

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

func IsPinnedGitRemote Uses

func IsPinnedGitRemote(repoURL string) bool

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

func ParsePinnedRemote Uses

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

ParsePinnedRemote returns the remote url and contraint value from repository url

Package versioncontrol imports 7 packages (graph) and is imported by 4 packages. Updated 2019-09-26. Refresh now. Tools for package owners.