cleanup output. start not doing stuff like this anymore
This commit is contained in:
parent
33c585f4cf
commit
bf59b9124a
|
@ -90,11 +90,11 @@ func (repo *Repo) gitDescribeByHash(hash string) (string, error) {
|
||||||
if hash == "" {
|
if hash == "" {
|
||||||
return "", errors.New("hash was blank")
|
return "", errors.New("hash was blank")
|
||||||
}
|
}
|
||||||
r, err := repo.RunQuiet([]string{"git", "describe", "--tags", "--always", hash})
|
r, err := repo.RunQuiet([]string{"git", "describe", "--tags", hash})
|
||||||
out := strings.Join(r.Stdout, "\n")
|
out := strings.Join(r.Stdout, "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn("not in a git repo or bad hash?", err, repo.GetGoPath())
|
// log.Warn("not in a git repo or bad hash?", err, repo.GetGoPath())
|
||||||
return out, err
|
return "gitpb err", err
|
||||||
}
|
}
|
||||||
return out, err
|
return out, err
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
|
||||||
|
|
||||||
if name == "" {
|
if name == "" {
|
||||||
// git will return the current tag
|
// git will return the current tag
|
||||||
r, err := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
|
r, err := repo.RunQuiet([]string{"git", "describe", "--tags"})
|
||||||
output := strings.Join(r.Stdout, "\n")
|
output := strings.Join(r.Stdout, "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Log(WARN, "gitDescribeByName() output might have worked anyway:", output)
|
log.Log(WARN, "gitDescribeByName() output might have worked anyway:", output)
|
||||||
|
@ -148,14 +148,14 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
|
||||||
// log.Log(WARN, "LocalTagExists()", name, "did not exist")
|
// log.Log(WARN, "LocalTagExists()", name, "did not exist")
|
||||||
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name)
|
return "", errors.New("gitDescribeByName() git fatal: Not a valid object name: " + name)
|
||||||
}
|
}
|
||||||
cmd := []string{"git", "describe", "--tags", "--always", name}
|
cmd := []string{"git", "describe", "--tags", name}
|
||||||
result, err := repo.RunQuiet(cmd)
|
result, err := repo.RunQuiet(cmd)
|
||||||
output := strings.Join(result.Stdout, "\n")
|
output := strings.Join(result.Stdout, "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Log(WARN, "cmd =", cmd)
|
//log.Log(WARN, "cmd =", cmd)
|
||||||
log.Log(WARN, "err =", err)
|
//log.Log(WARN, "err =", err)
|
||||||
log.Log(WARN, "output (might have worked with error?) =", output)
|
//log.Log(WARN, "output (might have worked with error?) =", output)
|
||||||
log.Log(WARN, "not in a git repo or bad tag?", repo.GetGoPath())
|
//log.Log(WARN, "not in a git repo or bad tag?", repo.GetGoPath())
|
||||||
return "", result.Error
|
return "", result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
reload.go
16
reload.go
|
@ -14,9 +14,11 @@ func (repo *Repo) ReloadCheck() error {
|
||||||
if !repo.DidRepoChange() {
|
if !repo.DidRepoChange() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// f.configSave = true
|
|
||||||
err := repo.Reload()
|
err := repo.Reload()
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return log.Errorf("gitpb.ReloadCheck() detected a change in the repo")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: clean this up more, but it is working now more or less
|
// TODO: clean this up more, but it is working now more or less
|
||||||
|
@ -73,7 +75,7 @@ func (repo *Repo) VerifyRemoteAndLocalBranches(bname string) bool {
|
||||||
// log.Info(r.FullPath, "local devel == remote devel", lh, rh)
|
// log.Info(r.FullPath, "local devel == remote devel", lh, rh)
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
log.Info(repo.FullPath, bname, "local != remote", lh, rh)
|
log.Info(lh, rh, "local != remote", repo.FullPath, bname)
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -109,11 +111,13 @@ func (repo *Repo) setCurrentBranchVersion() {
|
||||||
log.Info("repo.GetCurrentBranchVersion() repo == nil")
|
log.Info("repo.GetCurrentBranchVersion() repo == nil")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
r, err := repo.RunQuiet([]string{"git", "describe", "--tags", "--always"})
|
r, err := repo.RunQuiet([]string{"git", "describe", "--tags"})
|
||||||
output := strings.Join(r.Stdout, "\n")
|
output := strings.Join(r.Stdout, "\n")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Log(WARN, "GetCurrentBranchVersion() not in a git repo?", err, repo.GetGoPath())
|
// log.Log(WARN, "GetCurrentBranchVersion() not in a git repo?", err, repo.GetGoPath())
|
||||||
log.Log(WARN, "GetCurrentBranchVersion() output might have worked anyway:", output)
|
// log.Log(WARN, "GetCurrentBranchVersion() output might have worked anyway:", output)
|
||||||
|
repo.CurrentBranchVersion = "gitpb err"
|
||||||
|
return
|
||||||
}
|
}
|
||||||
repo.CurrentBranchVersion = strings.TrimSpace(output)
|
repo.CurrentBranchVersion = strings.TrimSpace(output)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue