diff options
| author | Jeff Carr <[email protected]> | 2024-01-13 20:30:33 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-13 20:30:33 -0600 |
| commit | 966348d5343a13ca889805d5a46907927d07f4ce (patch) | |
| tree | f82cf534206ebe399432d09c86d2b6e7672823f8 /git.go | |
| parent | 86873b296cb856a1b8e7251047ccb2b04d188f9b (diff) | |
status is almost done
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 60 |
1 files changed, 52 insertions, 8 deletions
@@ -8,6 +8,16 @@ import ( "go.wit.com/log" ) +func (rs *RepoStatus) GetCurrentBranchName() string { + return rs.currentBranch.Get() +} +func (rs *RepoStatus) GetCurrentBranchVersion() string { + return rs.currentVersion.Get() +} +func (rs *RepoStatus) GetLastTagVersion() string { + return rs.lasttag.Get() +} + func (rs *RepoStatus) getCurrentBranchName() string { out := run(rs.repopath, "git", "branch --show-current") log.Warn("getCurrentBranchName() =", out) @@ -78,14 +88,14 @@ func (rs *RepoStatus) getBranches() []string { return all } -func (rs *RepoStatus) checkDirty() bool { +func (rs *RepoStatus) CheckDirty() bool { out := run(rs.repopath, "git", "diff-index HEAD") if out == "" { - log.Warn("checkDirty() no", rs.repopath) + log.Warn("CheckDirty() no", rs.repopath) rs.dirtyLabel.Set("no") return false } else { - log.Warn("checkDirty() true", rs.repopath) + log.Warn("CheckDirty() true", rs.repopath) rs.dirtyLabel.Set("dirty") return true } @@ -93,7 +103,7 @@ func (rs *RepoStatus) checkDirty() bool { } func (rs *RepoStatus) checkoutBranch(level string, branch string) { - if rs.checkDirty() { + if rs.CheckDirty() { log.Warn("checkoutBranch() checkDirty() == true for repo", rs.repopath, "looking for branch:", branch) return } @@ -106,16 +116,50 @@ func (rs *RepoStatus) checkoutBranch(level string, branch string) { switch level { case "master": - rs.masterBranch.Set(realversion) + rs.masterBranchVersion.Set(realversion) case "devel": - rs.develBranch.Set(realversion) + rs.develBranchVersion.Set(realversion) case "user": - rs.jcarrBranch.Set(realversion) + rs.jcarrBranchVersion.Set(realversion) default: } } -func (rs *RepoStatus) checkBranches() bool { +// returns "master", "devel", os.Username, etc +func (rs *RepoStatus) GetMasterName() string { + name := rs.masterDrop.Get() + log.Warn("GetMasterName() =", name) + return name +} +func (rs *RepoStatus) GetDevelName() string { + name := rs.develDrop.Get() + log.Warn("GetDevelName() =", name) + return name +} +func (rs *RepoStatus) GetUserName() string { + name := rs.userDrop.Get() + log.Warn("GetUserName() =", name) + return name +} + +// returns the git versions like "1.3-2-laksdjf" or whatever +func (rs *RepoStatus) GetMasterVersion() string { + name := rs.masterBranchVersion.Get() + log.Warn("GetMasterVersion() =", name) + return name +} +func (rs *RepoStatus) GetDevelVersion() string { + name := rs.develBranchVersion.Get() + log.Warn("GetBranchVersion() =", name) + return name +} +func (rs *RepoStatus) GetUserVersion() string { + name := rs.jcarrBranchVersion.Get() + log.Warn("GetUserVersion() =", name) + return name +} + +func (rs *RepoStatus) CheckBranches() bool { var hashCheck string var perfect bool = true all := rs.getBranches() |
