diff options
Diffstat (limited to 'bug/operation_pack.go')
-rw-r--r-- | bug/operation_pack.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bug/operation_pack.go b/bug/operation_pack.go index 60016474..cce1845c 100644 --- a/bug/operation_pack.go +++ b/bug/operation_pack.go @@ -15,6 +15,9 @@ import ( // apply to get the final state of the Bug type OperationPack struct { Operations []Operation + + // Private field so not serialized by gob + commitHash util.Hash } func ParseOperationPack(data []byte) (*OperationPack, error) { @@ -73,3 +76,18 @@ func (opp *OperationPack) Write(repo repository.Repo) (util.Hash, error) { return hash, nil } + +// Make a deep copy +func (opp *OperationPack) Clone() OperationPack { + + clone := OperationPack{ + Operations: make([]Operation, len(opp.Operations)), + commitHash: opp.commitHash, + } + + for i, op := range opp.Operations { + clone.Operations[i] = op + } + + return clone +} |