summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-14 11:28:34 -0600
committerJeff Carr <[email protected]>2024-12-14 11:28:34 -0600
commit5341a70557f00b07e95802348c03aa25781ff5b7 (patch)
tree6e0c3a765f726622f2eff5c9fce0db23a4bf56d7
parent1e4b0c0d3742bc953d5b21e3d901e94d1268c72f (diff)
shortcut to get the age of a repov0.0.29
-rw-r--r--gitTag.byAge.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/gitTag.byAge.go b/gitTag.byAge.go
index 9d62acf..3341e08 100644
--- a/gitTag.byAge.go
+++ b/gitTag.byAge.go
@@ -29,3 +29,12 @@ func (a GitTagAge) Less(i, j int) bool {
return false
}
func (a GitTagAge) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+func (repo *Repo) NewestAge() time.Duration {
+ all := repo.Tags.SortByAge()
+ for all.Scan() {
+ r := all.Next()
+ return time.Since(r.GetAuthordate().AsTime())
+ }
+ return time.Since(time.Now())
+}