aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing')
-rw-r--r--plumbing/format/packfile/delta_selector.go2
-rw-r--r--plumbing/format/packfile/object_pack.go12
2 files changed, 9 insertions, 5 deletions
diff --git a/plumbing/format/packfile/delta_selector.go b/plumbing/format/packfile/delta_selector.go
index 98a91b9..6710085 100644
--- a/plumbing/format/packfile/delta_selector.go
+++ b/plumbing/format/packfile/delta_selector.go
@@ -231,7 +231,7 @@ func (dw *deltaSelector) walk(
delete(indexMap, obj.Hash())
if obj.IsDelta() {
- obj.SetOriginal(obj.Original)
+ obj.SaveOriginalMetadata()
obj.CleanOriginal()
}
}
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
}
}