aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/object_pack.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/format/packfile/object_pack.go')
-rw-r--r--plumbing/format/packfile/object_pack.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/plumbing/format/packfile/object_pack.go b/plumbing/format/packfile/object_pack.go
index 661278d..dfea571 100644
--- a/plumbing/format/packfile/object_pack.go
+++ b/plumbing/format/packfile/object_pack.go
@@ -81,11 +81,15 @@ func (o *ObjectToPack) WantWrite() bool {
// is nil Original is set but previous resolved values are kept
func (o *ObjectToPack) SetOriginal(obj plumbing.EncodedObject) {
o.Original = obj
+ o.SaveOriginalMetadata()
+}
- if obj != nil {
- o.originalSize = obj.Size()
- o.originalType = obj.Type()
- o.originalHash = obj.Hash()
+// SaveOriginalMetadata saves size, type and hash of Original object
+func (o *ObjectToPack) SaveOriginalMetadata() {
+ if o.Original != nil {
+ o.originalSize = o.Original.Size()
+ o.originalType = o.Original.Type()
+ o.originalHash = o.Original.Hash()
o.resolvedOriginal = true
}
}