Documentation
¶
Overview ¶
Package git allows to interact with Git.
Index ¶
- func GetCurrentBranchName(t testing.TestingT) stringdeprecated
- func GetCurrentBranchNameContext(t testing.TestingT, ctx context.Context, dir string) string
- func GetCurrentBranchNameContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- func GetCurrentBranchNameE(t testing.TestingT) (string, error)deprecated
- func GetCurrentBranchNameOldContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- func GetCurrentBranchNameOldE(t testing.TestingT) (string, error)deprecated
- func GetCurrentGitRef(t testing.TestingT) stringdeprecated
- func GetCurrentGitRefContext(t testing.TestingT, ctx context.Context, dir string) string
- func GetCurrentGitRefContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- func GetCurrentGitRefE(t testing.TestingT) (string, error)deprecated
- func GetRepoRoot(t testing.TestingT) stringdeprecated
- func GetRepoRootContext(t testing.TestingT, ctx context.Context, dir string) string
- func GetRepoRootContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- 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) string
- func GetRepoRootForDirContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- func GetRepoRootForDirE(t testing.TestingT, dir string) (string, error)deprecated
- func GetTagContextE(t testing.TestingT, ctx context.Context, dir string) (string, error)
- 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: Use GetCurrentBranchNameContext instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
func GetCurrentBranchNameContext ¶ 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.
func GetCurrentBranchNameContextE ¶ 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.
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: Use GetCurrentBranchNameContextE instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
func GetCurrentBranchNameOldContextE ¶ 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.
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: Use GetCurrentBranchNameOldContextE instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
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: Use GetCurrentGitRefContext instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
func GetCurrentGitRefContext ¶ 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.
func GetCurrentGitRefContextE ¶ 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.
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: Use GetCurrentGitRefContextE instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
func GetRepoRoot
deprecated
added in
v0.40.6
GetRepoRoot retrieves the path to the root directory of the repo. Fails the test if there is an error.
Deprecated: Use GetRepoRootContext instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
func GetRepoRootContext ¶ 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.
func GetRepoRootContextE ¶ 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.
func GetRepoRootE
deprecated
added in
v0.40.6
GetRepoRootE retrieves the path to the root directory of the repo.
Deprecated: Use GetRepoRootContextE instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
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: Use GetRepoRootForDirContext instead, which supports context cancellation.
func GetRepoRootForDirContext ¶ 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.
func GetRepoRootForDirContextE ¶ added in v1.0.0
GetRepoRootForDirContextE retrieves the path to the root directory of the repo in which dir resides.
func GetRepoRootForDirE
deprecated
added in
v0.46.10
func GetTagContextE ¶ 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.
func GetTagE
deprecated
added in
v0.29.0
GetTagE retrieves the lightweight (non-annotated) tag or exact tag value if the tag points to the current commit.
Deprecated: Use GetTagContextE instead, which supports context cancellation and accepts an explicit working directory rather than relying on the process working directory.
Types ¶
This section is empty.