aboutsummaryrefslogtreecommitdiffstats
path: root/bug/clocks.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-06 20:31:20 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-06 20:31:20 +0200
commit435be2b693aee89ed34a2d1e7291b3b141b19717 (patch)
tree89244a9dcb995c27002995e9f25f9be631101713 /bug/clocks.go
parent593891b8e01fd89866b30854a60aece1dad5f6ab (diff)
downloadgit-bug-435be2b693aee89ed34a2d1e7291b3b141b19717.tar.gz
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
Diffstat (limited to 'bug/clocks.go')
-rw-r--r--bug/clocks.go18
1 files changed, 18 insertions, 0 deletions
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
+}