6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-06 02:22:59 +00:00

Add a run package responsible for running git commands

- Add better git error handling
- Move repo helpers into a separate package
This commit is contained in:
Grzegorz Dlugoszewski
2020-06-26 13:36:58 +02:00
parent 7c5abae165
commit 28b24ec5ce
10 changed files with 482 additions and 399 deletions

View File

@@ -54,7 +54,7 @@ func Load(path string) *Loaded {
return loaded
}
func loadBranches(r *git.Repo) (map[string]string, []error) {
func loadBranches(r git.Repo) (map[string]string, []error) {
statuses := make(map[string]string)
errors := make([]error, 0)
@@ -75,7 +75,7 @@ func loadBranches(r *git.Repo) (map[string]string, []error) {
return statuses, errors
}
func loadBranchStatus(r *git.Repo, branch string) (string, error) {
func loadBranchStatus(r git.Repo, branch string) (string, error) {
upstream, err := r.Upstream(branch)
if err != nil {
return "", err
@@ -105,7 +105,7 @@ func loadBranchStatus(r *git.Repo, branch string) (string, error) {
return strings.Join(res, " "), nil
}
func loadWorkTree(r *git.Repo) (string, error) {
func loadWorkTree(r git.Repo) (string, error) {
uncommitted, err := r.Uncommitted()
if err != nil {
return "", err