@@ -3163,6 +3163,33 @@ static int add_ref_tag(const char *tag UNUSED, const char *referent UNUSED, cons
3163
3163
return 0 ;
3164
3164
}
3165
3165
3166
+ static int should_attempt_deltas (struct object_entry * entry )
3167
+ {
3168
+ if (DELTA (entry ))
3169
+ return 0 ;
3170
+
3171
+ if (!entry -> type_valid ||
3172
+ oe_size_less_than (& to_pack , entry , 50 ))
3173
+ return 0 ;
3174
+
3175
+ if (entry -> no_try_delta )
3176
+ return 0 ;
3177
+
3178
+ if (!entry -> preferred_base ) {
3179
+ if (oe_type (entry ) < 0 )
3180
+ die (_ ("unable to get type of object %s" ),
3181
+ oid_to_hex (& entry -> idx .oid ));
3182
+ } else if (oe_type (entry ) < 0 ) {
3183
+ /*
3184
+ * This object is not found, but we
3185
+ * don't have to include it anyway.
3186
+ */
3187
+ return 0 ;
3188
+ }
3189
+
3190
+ return 1 ;
3191
+ }
3192
+
3166
3193
static void prepare_pack (int window , int depth )
3167
3194
{
3168
3195
struct object_entry * * delta_list ;
@@ -3193,33 +3220,11 @@ static void prepare_pack(int window, int depth)
3193
3220
for (i = 0 ; i < to_pack .nr_objects ; i ++ ) {
3194
3221
struct object_entry * entry = to_pack .objects + i ;
3195
3222
3196
- if (DELTA (entry ))
3197
- /* This happens if we decided to reuse existing
3198
- * delta from a pack. "reuse_delta &&" is implied.
3199
- */
3200
- continue ;
3201
-
3202
- if (!entry -> type_valid ||
3203
- oe_size_less_than (& to_pack , entry , 50 ))
3223
+ if (!should_attempt_deltas (entry ))
3204
3224
continue ;
3205
3225
3206
- if (entry -> no_try_delta )
3207
- continue ;
3208
-
3209
- if (!entry -> preferred_base ) {
3226
+ if (!entry -> preferred_base )
3210
3227
nr_deltas ++ ;
3211
- if (oe_type (entry ) < 0 )
3212
- die (_ ("unable to get type of object %s" ),
3213
- oid_to_hex (& entry -> idx .oid ));
3214
- } else {
3215
- if (oe_type (entry ) < 0 ) {
3216
- /*
3217
- * This object is not found, but we
3218
- * don't have to include it anyway.
3219
- */
3220
- continue ;
3221
- }
3222
- }
3223
3228
3224
3229
delta_list [n ++ ] = entry ;
3225
3230
}
0 commit comments