summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitTag.byAge.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/gitTag.byAge.go b/gitTag.byAge.go
index f5e3188..6c4a852 100644
--- a/gitTag.byAge.go
+++ b/gitTag.byAge.go
@@ -87,6 +87,25 @@ func (repo *Repo) NewestAge() time.Duration {
return time.Since(newest)
}
+func (repo *Repo) NewestTime() time.Time {
+ alltags := repo.Tags.selectAllGitTags()
+
+ var newest time.Time
+
+ for _, tag := range alltags {
+ // check the actual age of the patch
+ if newest.Before(tag.Authordate.AsTime()) {
+ newest = tag.Authordate.AsTime()
+ }
+ // check the age of the commit
+ if newest.Before(tag.Creatordate.AsTime()) {
+ newest = tag.Creatordate.AsTime()
+ }
+ }
+
+ return newest
+}
+
func (repo *Repo) NewestAgeVerbose() time.Duration {
alltags := repo.Tags.selectAllGitTags()