diff options
| author | Jeff Carr <[email protected]> | 2024-01-11 15:56:50 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-11 15:56:50 -0600 |
| commit | 1248e21394afa41f5a5a42e843c3bd4cae71c5d6 (patch) | |
| tree | a97acc520dd1e31870e9cc89ecfd1bd861d311ad /git.go | |
| parent | 5d21e2f6f8ba1b62a848c6b614e98cea530bc085 (diff) | |
update for new gui API
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 46 |
1 files changed, 38 insertions, 8 deletions
@@ -45,6 +45,35 @@ func (rs *RepoStatus) populateTags() { // rs.tagsDrop.Set(rs.lasttagrev) } +/* +.git/refs/remotes +.git/refs/remotes/github +.git/refs/remotes/github/devel +.git/refs/remotes/github/main +.git/refs/remotes/origin +.git/refs/remotes/origin/devel +.git/refs/remotes/origin/main +.git/refs/remotes/origin/jcarr +.git/refs/heads +*/ + +func (rs *RepoStatus) getBranches() []string { + var all []string + var heads []string + var remotes []string + heads = listFiles(fullpath(rs.repopath + "/.git/refs/heads")) + remotes = listFiles(fullpath(rs.repopath + "/.git/refs/remotes")) + + all = heads + + all = append(all, remotes...) + + for _, branch := range all { + log.Warn("getBranches()", branch) + } + return all +} + func (rs *RepoStatus) checkDirty() bool { out := run(rs.repopath, "git", "diff-index HEAD") if out == "" { @@ -59,7 +88,7 @@ func (rs *RepoStatus) checkDirty() bool { } -func (rs *RepoStatus) checkoutBranch(branch string) { +func (rs *RepoStatus) checkoutBranch(level string, branch string) { if rs.checkDirty() { log.Warn("checkoutBranch() checkDirty() == true for repo", rs.repopath, "looking for branch:", branch) return @@ -70,13 +99,14 @@ func (rs *RepoStatus) checkoutBranch(branch string) { realname := rs.getCurrentBranchName() realversion := rs.getCurrentBranchVersion() log.Warn(rs.repopath, "realname =", realname, "realversion =", realversion) - if realname == "jcarr" { - rs.jcarrBranch.Set(realversion) - } - if realname == "devel" { - rs.develBranch.Set(realversion) - } - if realname == "master" { + + switch level { + case "master": rs.masterBranch.Set(realversion) + case "devel": + rs.develBranch.Set(realversion) + case "user": + rs.jcarrBranch.Set(realversion) + default: } } |
