From 435be2b693aee89ed34a2d1e7291b3b141b19717 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 6 Aug 2018 20:31:20 +0200 Subject: bug: add a Lamport logical clock to be able to sort bugs by creation time and edit time without having to rely on a timestamp --- bug/clocks.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bug/clocks.go (limited to 'bug/clocks.go') diff --git a/bug/clocks.go b/bug/clocks.go new file mode 100644 index 00000000..7b254746 --- /dev/null +++ b/bug/clocks.go @@ -0,0 +1,18 @@ +package bug + +import ( + "github.com/MichaelMure/git-bug/repository" +) + +func Witnesser(repo *repository.GitRepo) error { + for b := range ReadAllLocalBugs(repo) { + if b.Err != nil { + return b.Err + } + + repo.CreateWitness(b.Bug.createTime) + repo.EditWitness(b.Bug.editTime) + } + + return nil +} -- cgit