quiet git pull
This commit is contained in:
parent
fc849f6003
commit
035b4eb443
22
git.go
22
git.go
|
@ -40,23 +40,13 @@ func (rs *RepoStatus) Age() time.Duration {
|
|||
return time.Since(tagTime)
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) GitPull() error {
|
||||
var ErrorMissingGitConfig error = errors.New("missing .git/config")
|
||||
var ErrorGitPullOnLocal error = errors.New("git pull on local only branch")
|
||||
|
||||
func (rs *RepoStatus) GitPull() (string, error) {
|
||||
currentName := rs.GetCurrentBranchName()
|
||||
if rs.IsOnlyLocalTag(currentName) {
|
||||
log.Log(REPOWARN, rs.Path(), "can not git pull on local only branch", currentName)
|
||||
return nil
|
||||
}
|
||||
var found bool = false
|
||||
// okay, it's not local. Is it mapped in .git/config ?
|
||||
for name, branch := range rs.gitConfig.branches {
|
||||
log.Log(WARN, name, "remote:", branch.remote, "merge", branch.merge)
|
||||
if name == currentName {
|
||||
log.Log(WARN, "Found:", name, "remote:", branch.remote, "merge", branch.merge)
|
||||
found = true
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return errors.New("git config error")
|
||||
return "", ErrorGitPullOnLocal
|
||||
}
|
||||
var cmd []string
|
||||
cmd = append(cmd, "git", "pull")
|
||||
|
@ -70,7 +60,7 @@ func (rs *RepoStatus) GitPull() error {
|
|||
} else {
|
||||
log.Log(REPOWARN, "git pull error", rs.Path(), err)
|
||||
}
|
||||
return err
|
||||
return output, err
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
6
merge.go
6
merge.go
|
@ -46,13 +46,13 @@ func (rs *RepoStatus) fetchBranch(apple string) (error, string) {
|
|||
if rs.gitConfig == nil {
|
||||
return errors.New("missing .git/config"), ""
|
||||
}
|
||||
log.Log(REPOWARN, rs.Name(), "looking for branch:", apple)
|
||||
log.Log(REPO, rs.Name(), "looking for branch:", apple)
|
||||
for name, branch := range rs.gitConfig.branches {
|
||||
if name == apple {
|
||||
// found the branch!
|
||||
log.Log(REPOWARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
|
||||
log.Log(REPO, " ", name, "remote:", branch.remote, "merge", branch.merge)
|
||||
cmd := []string{"git", "fetch", branch.remote, apple + ":" + apple}
|
||||
log.Log(REPOWARN, "running:", rs.Name(), cmd)
|
||||
log.Log(REPO, "running:", rs.Name(), cmd)
|
||||
err, out := rs.RunCmd(cmd)
|
||||
return err, out
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue