diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-17 01:52:56 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-17 01:52:56 +0200 |
commit | 0180b68cb0bb3aecf9b4a6186094a084762b4a25 (patch) | |
tree | 95597554cfdda76b9f6cc5aab7c3fd5b24a3db75 /bug/operation_pack.go | |
parent | 1d678dfdfa026968dbb19795c9bed16385603b21 (diff) | |
download | git-bug-0180b68cb0bb3aecf9b4a6186094a084762b4a25.tar.gz |
implement pull/merge
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 +} |