might show branch age?
This commit is contained in:
parent
966e3d7858
commit
53acead41e
|
@ -104,3 +104,34 @@ func (repo *Repo) NewestAgeVerbose() time.Duration {
|
|||
|
||||
return time.Since(newest)
|
||||
}
|
||||
|
||||
// not really accurate. temprorary until git Config() parsing is better
|
||||
func (repo *Repo) BranchAge(branch string) time.Duration {
|
||||
alltags := repo.Tags.selectAllGitTags()
|
||||
|
||||
var newest time.Time
|
||||
var cur time.Time
|
||||
var auth time.Time
|
||||
|
||||
for _, tag := range alltags {
|
||||
cur = tag.Creatordate.AsTime()
|
||||
auth = tag.Authordate.AsTime()
|
||||
if branch == filepath.Base(tag.Refname) {
|
||||
// log.Info("\t\tfound tag", i, branch, tag.Authordate.AsTime(), tag.Creatordate.AsTime())
|
||||
if cur.Before(auth) {
|
||||
return time.Since(auth)
|
||||
}
|
||||
return time.Since(cur)
|
||||
}
|
||||
|
||||
// check both dates I guess
|
||||
if newest.Before(auth) {
|
||||
newest = auth
|
||||
}
|
||||
if newest.Before(cur) {
|
||||
newest = cur
|
||||
}
|
||||
}
|
||||
|
||||
return time.Since(newest)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue