Documentation ¶
Index ¶
- Variables
- func BranchName() string
- func CommitHash() string
- func Exec(subcmd string, args ...string) *modmake.Command
- func ExecOutput(subcmd string, args ...string) (string, error)
- func ExecOutputCtx(ctx context.Context, subcmd string, args ...string) (string, error)
- func RepositoryRoot() string
- func SubmoduleUpdateInit(path ...string) modmake.Task
- func SubmoduleUpdateRemote(path ...string) modmake.Task
Constants ¶
This section is empty.
Variables ¶
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
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
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
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
SubmoduleUpdateInit will run 'git submodule update --init <path>'.
func SubmoduleUpdateRemote ¶ added in v0.4.0
SubmoduleUpdateRemote will run 'git submodule update --remote <path>'.
Types ¶
This section is empty.