aboutsummaryrefslogtreecommitdiffstats
path: root/bug/operation_pack.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-08-13 15:28:16 +0200
committerMichael Muré <batolettre@gmail.com>2018-08-13 15:28:47 +0200
commitdf144e727a858ed07e3c9328d91efe052c4781e1 (patch)
treebfbfeea70f97ab3d4274c8e5add2c3aeeac1423b /bug/operation_pack.go
parentf2f779c5a8b4efe67317bbffe110a9880c1f529a (diff)
downloadgit-bug-df144e727a858ed07e3c9328d91efe052c4781e1.tar.gz
fix some linting trouble
Diffstat (limited to 'bug/operation_pack.go')
-rw-r--r--bug/operation_pack.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/bug/operation_pack.go b/bug/operation_pack.go
index cce1845c..5de60bde 100644
--- a/bug/operation_pack.go
+++ b/bug/operation_pack.go
@@ -20,6 +20,7 @@ type OperationPack struct {
commitHash util.Hash
}
+// ParseOperationPack will deserialize an OperationPack from raw bytes
func ParseOperationPack(data []byte) (*OperationPack, error) {
reader := bytes.NewReader(data)
decoder := gob.NewDecoder(reader)
@@ -35,6 +36,7 @@ func ParseOperationPack(data []byte) (*OperationPack, error) {
return &opp, nil
}
+// Serialize will serialise an OperationPack into raw bytes
func (opp *OperationPack) Serialize() ([]byte, error) {
var data bytes.Buffer
@@ -53,14 +55,18 @@ func (opp *OperationPack) Append(op Operation) {
opp.Operations = append(opp.Operations, op)
}
+// IsEmpty tell if the OperationPack is empty
func (opp *OperationPack) IsEmpty() bool {
return len(opp.Operations) == 0
}
+// IsValid tell if the OperationPack is considered valid
func (opp *OperationPack) IsValid() bool {
return !opp.IsEmpty()
}
+// Write will serialize and store the OperationPack as a git blob and return
+// its hash
func (opp *OperationPack) Write(repo repository.Repo) (util.Hash, error) {
data, err := opp.Serialize()