diff options
| author | Jeff Carr <[email protected]> | 2024-12-14 11:28:34 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-14 11:28:34 -0600 |
| commit | 5341a70557f00b07e95802348c03aa25781ff5b7 (patch) | |
| tree | 6e0c3a765f726622f2eff5c9fce0db23a4bf56d7 | |
| parent | 1e4b0c0d3742bc953d5b21e3d901e94d1268c72f (diff) | |
shortcut to get the age of a repov0.0.29
| -rw-r--r-- | gitTag.byAge.go | 9 |
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()) +} |
