aboutsummaryrefslogtreecommitdiffstats
path: root/bug
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-14 06:42:13 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-14 06:42:13 +0200
commit499669c144218704c0942860564325d76adb13e2 (patch)
treef3ecae072b242d4dc37f30879323bf64fc47303c /bug
parent55aef8c38773a7cce39a5e154f8221a4b817ac04 (diff)
downloadgit-bug-499669c144218704c0942860564325d76adb13e2.tar.gz
each commit reference the very first set of ops (will be useful for fast access to lamport clock and ordering)
Diffstat (limited to 'bug')
-rw-r--r--bug/bug.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/bug/bug.go b/bug/bug.go
index 658d73e1..fc7c0c2a 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -18,6 +18,7 @@ type Bug struct {
id uuid.UUID
lastCommit util.Hash
+ root util.Hash
// TODO: need a way to order bugs, probably a Lamport clock
@@ -88,7 +89,7 @@ func (bug *Bug) Append(op Operation) {
bug.staging.Append(op)
}
-// Write the staging area in Git move the operations to the packs
+// Write the staging area in Git and move the operations to the packs
func (bug *Bug) Commit(repo repository.Repo) error {
if bug.staging.IsEmpty() {
return nil
@@ -100,9 +101,15 @@ func (bug *Bug) Commit(repo repository.Repo) error {
return err
}
+ root := bug.root
+ if root == "" {
+ root = hash
+ }
+
// Write a Git tree referencing this blob
hash, err = repo.StoreTree(map[string]util.Hash{
- "ops": hash,
+ "ops": hash, // the last pack of ops
+ "root": root, // always the first pack of ops (might be the same)
})
if err != nil {
return err