This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -96,9 +96,7 @@ func (dw *deltaSelector) fixAndBreakChains(objectsToPack []*ObjectToPack) error
9696}
9797
9898func (dw * deltaSelector ) fixAndBreakChainsOne (objectsToPack map [plumbing.Hash ]* ObjectToPack , otp * ObjectToPack ) error {
99- isDelta := otp .Object .Type () == plumbing .OFSDeltaObject ||
100- otp .Object .Type () == plumbing .REFDeltaObject
101- if ! isDelta {
99+ if ! otp .Object .Type ().IsDelta () {
102100 return nil
103101 }
104102
@@ -141,9 +139,7 @@ func (dw *deltaSelector) restoreOriginal(otp *ObjectToPack) error {
141139 return nil
142140 }
143141
144- isDelta := otp .Object .Type () == plumbing .OFSDeltaObject ||
145- otp .Object .Type () == plumbing .REFDeltaObject
146- if ! isDelta {
142+ if ! otp .Object .Type ().IsDelta () {
147143 return nil
148144 }
149145
Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ func (t ObjectType) Valid() bool {
8282 return t >= CommitObject && t <= REFDeltaObject
8383}
8484
85+ // IsDelta returns true for any ObjectTyoe that represents a delta (i.e.
86+ // REFDeltaObject or OFSDeltaObject).
87+ func (t ObjectType ) IsDelta () bool {
88+ return t == REFDeltaObject || t == OFSDeltaObject
89+ }
90+
8591// ParseObjectType parses a string representation of ObjectType. It returns an
8692// error on parse failure.
8793func ParseObjectType (value string ) (typ ObjectType , err error ) {
You can’t perform that action at this time.
0 commit comments