aboutsummaryrefslogtreecommitdiffstats
path: root/bug/bug.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-09-11 22:04:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-09-11 22:14:46 +0200
commit3605887345792d2f981f971c6c4a2cb7f86a343e (patch)
treeafd525b6e3a638e4c619a5a986fcb2811c297444 /bug/bug.go
parent7b05983c19af4da70f2a9a5062913f4e4f5d5faa (diff)
downloadgit-bug-3605887345792d2f981f971c6c4a2cb7f86a343e.tar.gz
reorganize package for a more idomatic go
Diffstat (limited to 'bug/bug.go')
-rw-r--r--bug/bug.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/bug/bug.go b/bug/bug.go
index e0c671c6..ac078866 100644
--- a/bug/bug.go
+++ b/bug/bug.go
@@ -6,7 +6,8 @@ import (
"strings"
"github.com/MichaelMure/git-bug/repository"
- "github.com/MichaelMure/git-bug/util"
+ "github.com/MichaelMure/git-bug/util/git"
+ "github.com/MichaelMure/git-bug/util/lamport"
)
const bugsRefPattern = "refs/bugs/"
@@ -34,14 +35,14 @@ type Bug struct {
// A Lamport clock is a logical clock that allow to order event
// inside a distributed system.
// It must be the first field in this struct due to https://github.com/golang/go/issues/599
- createTime util.LamportTime
- editTime util.LamportTime
+ createTime lamport.Time
+ editTime lamport.Time
// Id used as unique identifier
id string
- lastCommit util.Hash
- rootPack util.Hash
+ lastCommit git.Hash
+ rootPack git.Hash
// all the committed operations
packs []OperationPack
@@ -173,10 +174,10 @@ func readBug(repo repository.Repo, ref string) (*Bug, error) {
if bug.rootPack == "" {
bug.rootPack = rootEntry.Hash
- bug.createTime = util.LamportTime(createTime)
+ bug.createTime = lamport.Time(createTime)
}
- bug.editTime = util.LamportTime(editTime)
+ bug.editTime = lamport.Time(editTime)
// Update the clocks
if err := repo.CreateWitness(bug.createTime); err != nil {
@@ -446,7 +447,7 @@ func (bug *Bug) Commit(repo repository.Repo) error {
func makeMediaTree(pack OperationPack) []repository.TreeEntry {
var tree []repository.TreeEntry
counter := 0
- added := make(map[util.Hash]interface{})
+ added := make(map[git.Hash]interface{})
for _, ops := range pack.Operations {
for _, file := range ops.Files() {
@@ -576,12 +577,12 @@ func (bug *Bug) HumanId() string {
}
// CreateLamportTime return the Lamport time of creation
-func (bug *Bug) CreateLamportTime() util.LamportTime {
+func (bug *Bug) CreateLamportTime() lamport.Time {
return bug.createTime
}
// EditLamportTime return the Lamport time of the last edit
-func (bug *Bug) EditLamportTime() util.LamportTime {
+func (bug *Bug) EditLamportTime() lamport.Time {
return bug.editTime
}