Documentation
¶
Index ¶
- func CheckoutBareRepo(repoPath, workTree string, force, all bool) error
- func EnsureOnDefaultBranch(repoPath string) error
- func FetchBareRepo(repoPath, workTree string) error
- func GetCurrentBranch(repoPath string) (string, error)
- func GetDevelopBranch(repoPath string) (string, error)
- func GetGitLabHostAndProjectPath(repoPath string) (string, string, error)
- func GetMainBranch(repoPath string) (string, error)
- func IsDirty(repoPath string) (bool, error)
- func PullLatestCode(repoPath string) error
- func PullRebaseBareRepo(repoPath, workTree string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckoutBareRepo ¶
CheckoutBareRepo performs a git checkout operation for a bare repository. It takes the repository path `repoPath` and work tree `workTree` as inputs. If force is true, it will discard any local changes and force the checkout. If all is true, it will checkout all files from the index/HEAD. Returns an error if the operation fails.
func EnsureOnDefaultBranch ¶
EnsureOnDefaultBranch ensures that the repository is on the default branch (main or master). It dynamically detects the default branch and switches to it if necessary. It takes the repository path `repoPath` as input and returns an error if the operation fails.
func FetchBareRepo ¶
FetchBareRepo fetches updates for a bare repository. It takes the repository path `repoPath` and work tree `workTree` as inputs and returns an error if the operation fails.
func GetCurrentBranch ¶
GetCurrentBranch returns the current branch name for the repository.
func GetDevelopBranch ¶
GetDevelopBranch returns the development branch name for the repository (develop, dev, or development). It checks for common development branch names and returns the one that exists.
func GetGitLabHostAndProjectPath ¶
GetGitLabHostAndProjectPath attempts to detect GitLab host and project path from the current repo remote. It returns host (e.g., gitlab.com) and project path (e.g., group/subgroup/repo).
func GetMainBranch ¶
GetMainBranch returns the main branch name for the repository (main or master). It checks for both main and master branches and returns the one that exists.
func IsDirty ¶
IsDirty checks if the repository at the given path has uncommitted changes. It takes the repository path `repoPath` as input and returns a boolean indicating whether the repository is dirty and an error if any occurs.
func PullLatestCode ¶
PullLatestCode pulls the latest changes from the current branch of the repository. It takes the repository path `repoPath` as input and returns an error if the operation fails. The function automatically detects the current branch and pulls from the corresponding remote.
func PullRebaseBareRepo ¶
PullRebaseBareRepo performs a pull with rebase operation for a bare repository. It takes the repository path `repoPath` and work tree `workTree` as inputs and returns an error if the operation fails.
Types ¶
This section is empty.