This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree 2 files changed +8
-6
lines changed
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
96
96
}
97
97
98
98
func (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 () {
102
100
return nil
103
101
}
104
102
@@ -141,9 +139,7 @@ func (dw *deltaSelector) restoreOriginal(otp *ObjectToPack) error {
141
139
return nil
142
140
}
143
141
144
- isDelta := otp .Object .Type () == plumbing .OFSDeltaObject ||
145
- otp .Object .Type () == plumbing .REFDeltaObject
146
- if ! isDelta {
142
+ if ! otp .Object .Type ().IsDelta () {
147
143
return nil
148
144
}
149
145
Original file line number Diff line number Diff line change @@ -82,6 +82,12 @@ func (t ObjectType) Valid() bool {
82
82
return t >= CommitObject && t <= REFDeltaObject
83
83
}
84
84
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
+
85
91
// ParseObjectType parses a string representation of ObjectType. It returns an
86
92
// error on parse failure.
87
93
func ParseObjectType (value string ) (typ ObjectType , err error ) {
You can’t perform that action at this time.
0 commit comments