|
@@ -13,7 +13,7 @@ import (
|
|
|
// It is a PipelineItem.
|
|
|
type DaysSinceStart struct {
|
|
|
core.NoopMerger
|
|
|
- day0 time.Time
|
|
|
+ day0 *time.Time
|
|
|
previousDay int
|
|
|
commits map[int][]plumbing.Hash
|
|
|
}
|
|
@@ -63,7 +63,7 @@ func (days *DaysSinceStart) Configure(facts map[string]interface{}) {
|
|
|
// Initialize resets the temporary caches and prepares this PipelineItem for a series of Consume()
|
|
|
// calls. The repository which is going to be analysed is supplied as an argument.
|
|
|
func (days *DaysSinceStart) Initialize(repository *git.Repository) {
|
|
|
- days.day0 = time.Time{}
|
|
|
+ days.day0 = &time.Time{}
|
|
|
days.previousDay = 0
|
|
|
if len(days.commits) > 0 {
|
|
|
keys := make([]int, len(days.commits))
|
|
@@ -86,11 +86,11 @@ func (days *DaysSinceStart) Consume(deps map[string]interface{}) (map[string]int
|
|
|
index := deps[core.DependencyIndex].(int)
|
|
|
if index == 0 {
|
|
|
// first iteration - initialize the file objects from the tree
|
|
|
- days.day0 = commit.Author.When
|
|
|
+ *days.day0 = commit.Author.When
|
|
|
// our precision is 1 day
|
|
|
- days.day0 = days.day0.Truncate(24 * time.Hour)
|
|
|
+ *days.day0 = days.day0.Truncate(24 * time.Hour)
|
|
|
}
|
|
|
- day := int(commit.Author.When.Sub(days.day0).Hours() / 24)
|
|
|
+ day := int(commit.Author.When.Sub(*days.day0).Hours() / 24)
|
|
|
if day < days.previousDay {
|
|
|
// rebase works miracles, but we need the monotonous time
|
|
|
day = days.previousDay
|