aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/format/packfile/delta_selector.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-02-09 11:39:18 +0100
committerJavi Fontan <jfontan@gmail.com>2018-02-09 11:39:18 +0100
commitd2273d2510d16c258d46ee72b87fd28b8850f1f2 (patch)
treec064707bdbc306edbe25865d203747800fd2092d /plumbing/format/packfile/delta_selector.go
parent3a9d5e236ef38854c0e0acc1ba924260060c755a (diff)
downloadgo-git-d2273d2510d16c258d46ee72b87fd28b8850f1f2.tar.gz
plumbing: format/packfile, fix panic retrieving object hash.
In some cases the original data is not saved before it is cleaned and forces a panic when it's needed. The change adds ObjectToPack.CleanOriginal to be used to clean original object instead of: object.Original = nil Now when the Original data is freed because it's no longer in the pack window a SetOriginal call is done to make sure that Size, Hash and Size data is not lost. Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'plumbing/format/packfile/delta_selector.go')
-rw-r--r--plumbing/format/packfile/delta_selector.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/plumbing/format/packfile/delta_selector.go b/plumbing/format/packfile/delta_selector.go
index 1d9fb5f..98a91b9 100644
--- a/plumbing/format/packfile/delta_selector.go
+++ b/plumbing/format/packfile/delta_selector.go
@@ -103,7 +103,7 @@ func (dw *deltaSelector) objectsToPack(
otp := newObjectToPack(o)
if _, ok := o.(plumbing.DeltaObject); ok {
- otp.Original = nil
+ otp.CleanOriginal()
}
objectsToPack = append(objectsToPack, otp)
@@ -231,7 +231,8 @@ func (dw *deltaSelector) walk(
delete(indexMap, obj.Hash())
if obj.IsDelta() {
- obj.Original = nil
+ obj.SetOriginal(obj.Original)
+ obj.CleanOriginal()
}
}