git

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGit = errors.New("unable to locate git executable")
)

Functions

func BranchName added in v0.4.0

func BranchName() string

BranchName returns the name of the currently checked out branch.

func CommitHash added in v0.4.0

func CommitHash() string

CommitHash returns the commit hash of the currently checked out commit.

func Exec added in v0.4.0

func Exec(subcmd string, args ...string) *modmake.Command

Exec will produce a modmake.Command that executes a git command. This function will panic if a git executable cannot be located on the PATH.

func ExecOutput added in v0.4.0

func ExecOutput(subcmd string, args ...string) (string, error)

ExecOutput will delegate to Exec and run the returned modmake.Command, but will collect its output into a string. This will also set a max execution time of 5 seconds. If you want to override this timeout or exit after some other condition, then use ExecOutputCtx.

func ExecOutputCtx added in v0.4.0

func ExecOutputCtx(ctx context.Context, subcmd string, args ...string) (string, error)

ExecOutputCtx will delegate to Exec and run the returned modmake.Command, but will collect its output into a string. If the context is cancelled, then the command will exit.

func RepositoryRoot added in v0.4.0

func RepositoryRoot() string

RepositoryRoot will attempt to locate the root path of the git repository.

func SubmoduleUpdateInit added in v0.4.0

func SubmoduleUpdateInit(path ...string) modmake.Task

SubmoduleUpdateInit will run 'git submodule update --init <path>'.

func SubmoduleUpdateRemote added in v0.4.0

func SubmoduleUpdateRemote(path ...string) modmake.Task

SubmoduleUpdateRemote will run 'git submodule update --remote <path>'.

Types

This section is empty.

Jump to

Keyboard shortcuts

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