Documentation
¶
Overview ¶
Package git provides helpers for interacting with local git repositories and configurations.
Index ¶
- func CurrentBranch(ctx context.Context, dir string) (string, error)
- func GetOrFetchBaseBranch(ctx context.Context, f forges.Forge, dir, owner, repo, branch string, ...) (string, error)
- func GetPRNumber(ctx context.Context, dir, branch string) (int, error)
- func SetBaseBranch(ctx context.Context, dir, branch, base string) error
- func SetPRNumber(ctx context.Context, dir, branch string, number int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentBranch ¶ added in v0.7.0
CurrentBranch returns the current local branch name.
func GetOrFetchBaseBranch ¶
func GetOrFetchBaseBranch(ctx context.Context, f forges.Forge, dir, owner, repo, branch string, forceRefresh bool) (string, error)
GetOrFetchBaseBranch returns the base branch of the given branch. It first checks the local git configuration for a cached value. If not found, it queries the forge API for an open pull request for the branch, caches the base branch name in the local git configuration, and returns it. If branch is empty, it uses the current branch.
func GetPRNumber ¶ added in v0.7.0
GetPRNumber returns the cached pull request number for a branch.
func SetBaseBranch ¶
SetBaseBranch caches the base branch for a branch in the local git configuration.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.