Documentation
¶
Overview ¶
Package git allows to interact with Git.
Deprecated: The git package is scheduled for removal in Terratest v2. Each helper here wraps a single git command (for example, git rev-parse or git describe); call git directly with os/exec instead. There is no public replacement; the package is being dropped.
Index ¶
- func GetCurrentBranchName(t testing.TestingT) stringdeprecated
- func GetCurrentBranchNameContext(t testing.TestingT, ctx context.Context, dir string) stringdeprecated
- func GetCurrentBranchNameContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetCurrentBranchNameE(t testing.TestingT) (string, error)deprecated
- func GetCurrentBranchNameOldContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetCurrentBranchNameOldE(t testing.TestingT) (string, error)deprecated
- func GetCurrentGitRef(t testing.TestingT) stringdeprecated
- func GetCurrentGitRefContext(t testing.TestingT, ctx context.Context, dir string) stringdeprecated
- func GetCurrentGitRefContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetCurrentGitRefE(t testing.TestingT) (string, error)deprecated
- func GetRepoRoot(t testing.TestingT) stringdeprecated
- func GetRepoRootContext(t testing.TestingT, ctx context.Context, dir string) stringdeprecated
- func GetRepoRootContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetRepoRootE(t testing.TestingT) (string, error)deprecated
- func GetRepoRootForDir(t testing.TestingT, dir string) stringdeprecated
- func GetRepoRootForDirContext(t testing.TestingT, ctx context.Context, dir string) stringdeprecated
- func GetRepoRootForDirContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetRepoRootForDirE(t testing.TestingT, dir string) (string, error)deprecated
- func GetTagContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)deprecated
- func GetTagE(t testing.TestingT) (string, error)deprecated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentBranchName
deprecated
GetCurrentBranchName retrieves the current branch name or an empty string in case of detached state. Fails the test if an error occurs.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.Command("git", "branch", "--show-current").Output() (empty when detached).
func GetCurrentBranchNameContext
deprecated
added in
v1.0.0
GetCurrentBranchNameContext retrieves the current branch name or an empty string in case of detached state. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used. Fails the test if an error occurs.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "branch", "--show-current") with cmd.Dir = dir, then .Output().
func GetCurrentBranchNameContextE
deprecated
added in
v1.0.0
func GetCurrentBranchNameContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
GetCurrentBranchNameContextE retrieves the current branch name or an empty string in case of detached state. Uses git branch --show-current, which was introduced in git v2.22. Falls back to git rev-parse for older versions. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "branch", "--show-current") with cmd.Dir = dir, then .Output().
func GetCurrentBranchNameE
deprecated
GetCurrentBranchNameE retrieves the current branch name or an empty string in case of detached state. Uses git branch --show-current, which was introduced in git v2.22. Falls back to git rev-parse for older versions.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.Command("git", "branch", "--show-current").Output() (empty when detached).
func GetCurrentBranchNameOldContextE
deprecated
added in
v1.0.0
func GetCurrentBranchNameOldContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
GetCurrentBranchNameOldContextE retrieves the current branch name or an empty string in case of detached state using git rev-parse --abbrev-ref HEAD. This is a fallback for git versions older than v2.22 that lack git branch --show-current. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "rev-parse", "--abbrev-ref", "HEAD") with cmd.Dir = dir, then .Output().
func GetCurrentBranchNameOldE
deprecated
added in
v0.32.15
GetCurrentBranchNameOldE retrieves the current branch name or an empty string in case of detached state using git rev-parse --abbrev-ref HEAD.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD").Output() (prints "HEAD" when detached; map it to "").
func GetCurrentGitRef
deprecated
added in
v0.29.0
GetCurrentGitRef retrieves the current branch name, lightweight (non-annotated) tag, or exact tag value if the tag points to the current commit. Fails the test if an error occurs.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly: try git branch --show-current, then git describe --tags when detached.
func GetCurrentGitRefContext
deprecated
added in
v1.0.0
GetCurrentGitRefContext retrieves the current branch name, lightweight (non-annotated) tag, or exact tag value if the tag points to the current commit. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used. Fails the test if an error occurs.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly: try git branch --show-current, then git describe --tags when detached (set cmd.Dir = dir).
func GetCurrentGitRefContextE
deprecated
added in
v1.0.0
GetCurrentGitRefContextE retrieves the current branch name, lightweight (non-annotated) tag, or exact tag value if the tag points to the current commit. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly: try git branch --show-current, then git describe --tags when detached (set cmd.Dir = dir).
func GetCurrentGitRefE
deprecated
added in
v0.29.0
GetCurrentGitRefE retrieves the current branch name, lightweight (non-annotated) tag, or exact tag value if the tag points to the current commit.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly: try git branch --show-current, then git describe --tags when detached.
func GetRepoRoot
deprecated
added in
v0.40.6
func GetRepoRootContext
deprecated
added in
v1.0.0
GetRepoRootContext retrieves the path to the root directory of the repo. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used. Fails the test if there is an error.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetRepoRootContextE
deprecated
added in
v1.0.0
GetRepoRootContextE retrieves the path to the root directory of the repo. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetRepoRootE
deprecated
added in
v0.40.6
func GetRepoRootForDir
deprecated
added in
v0.46.10
GetRepoRootForDir retrieves the path to the root directory of the repo in which dir resides. Fails the test if there is an error.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.Command("git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetRepoRootForDirContext
deprecated
added in
v1.0.0
GetRepoRootForDirContext retrieves the path to the root directory of the repo in which dir resides. Fails the test if there is an error.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetRepoRootForDirContextE
deprecated
added in
v1.0.0
GetRepoRootForDirContextE retrieves the path to the root directory of the repo in which dir resides.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetRepoRootForDirE
deprecated
added in
v0.46.10
GetRepoRootForDirE retrieves the path to the root directory of the repo in which dir resides.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.Command("git", "rev-parse", "--show-toplevel") with cmd.Dir = dir, then .Output().
func GetTagContextE
deprecated
added in
v1.0.0
GetTagContextE retrieves the lightweight (non-annotated) tag or exact tag value if the tag points to the current commit. The dir parameter specifies the working directory for the git command; if empty, the process working directory is used.
Deprecated: scheduled for removal in Terratest v2. Shell out to git directly, e.g. exec.CommandContext(ctx, "git", "describe", "--tags") with cmd.Dir = dir, then .Output().
func GetTagE
deprecated
added in
v0.29.0
Types ¶
This section is empty.