summaryrefslogtreecommitdiff
path: root/git.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-22 17:19:29 -0600
committerJeff Carr <[email protected]>2024-02-22 17:19:29 -0600
commit359ebce26ee2223fdd05e8a04f75f15415ec0457 (patch)
treeaa2e82ec577d9abed0acb9138a43c13d40b76caa /git.go
parentcd5f1d9d0f52196d6ea07684a4307369893911bd (diff)
mtime
Diffstat (limited to 'git.go')
-rw-r--r--git.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/git.go b/git.go
index c54ab8c..3dffb97 100644
--- a/git.go
+++ b/git.go
@@ -20,6 +20,10 @@ func (rs *RepoStatus) GetCurrentBranchVersion() string {
return rs.currentVersion.String()
}
+func (rs *RepoStatus) LastGitPull() (time.Time, error) {
+ return rs.mtime(".git/FETCH_HEAD")
+}
+
func (rs *RepoStatus) Age() time.Duration {
var t *Tag
t = rs.NewestTag()
@@ -35,6 +39,19 @@ func (rs *RepoStatus) Age() time.Duration {
return time.Since(tagTime)
}
+func (rs *RepoStatus) GitPull() error {
+ var cmd []string
+ cmd = append(cmd, "git", "pull")
+ err, _, output := RunCmd(rs.realPath.String(), cmd)
+ if err == nil {
+ log.Log(REPOWARN,"git pull ran", rs.Path())
+ log.Log(REPOWARN,"git pull output", output)
+ } else {
+ log.Log(REPOWARN,"git pull error", rs.Path(), err)
+ }
+ return err
+}
+
/*
// this isn't right
func (rs *RepoStatus) LastTagAge() (time.Time, string) {