aboutsummaryrefslogtreecommitdiffstats
path: root/bug/clocks.go
blob: 52d2354443db67c118c560584f6ee5763d1a612f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package bug

import (
	"github.com/MichaelMure/git-bug/repository"
)

// Witnesser will read all the available Bug to recreate the different logical
// clocks
func Witnesser(repo repository.ClockedRepo) error {
	for b := range ReadAllLocalBugs(repo) {
		if b.Err != nil {
			return b.Err
		}

		err := repo.WitnessCreate(b.Bug.createTime)
		if err != nil {
			return err
		}

		err = repo.WitnessEdit(b.Bug.editTime)
		if err != nil {
			return err
		}
	}

	return nil
}