@@ -3196,6 +3196,33 @@ static int add_ref_tag(const char *tag UNUSED, const char *referent UNUSED, cons
3196
3196
return 0 ;
3197
3197
}
3198
3198
3199
+ static int should_attempt_deltas (struct object_entry * entry )
3200
+ {
3201
+ if (DELTA (entry ))
3202
+ return 0 ;
3203
+
3204
+ if (!entry -> type_valid ||
3205
+ oe_size_less_than (& to_pack , entry , 50 ))
3206
+ return 0 ;
3207
+
3208
+ if (entry -> no_try_delta )
3209
+ return 0 ;
3210
+
3211
+ if (!entry -> preferred_base ) {
3212
+ if (oe_type (entry ) < 0 )
3213
+ die (_ ("unable to get type of object %s" ),
3214
+ oid_to_hex (& entry -> idx .oid ));
3215
+ } else if (oe_type (entry ) < 0 ) {
3216
+ /*
3217
+ * This object is not found, but we
3218
+ * don't have to include it anyway.
3219
+ */
3220
+ return 0 ;
3221
+ }
3222
+
3223
+ return 1 ;
3224
+ }
3225
+
3199
3226
static void prepare_pack (int window , int depth )
3200
3227
{
3201
3228
struct object_entry * * delta_list ;
@@ -3226,33 +3253,11 @@ static void prepare_pack(int window, int depth)
3226
3253
for (i = 0 ; i < to_pack .nr_objects ; i ++ ) {
3227
3254
struct object_entry * entry = to_pack .objects + i ;
3228
3255
3229
- if (DELTA (entry ))
3230
- /* This happens if we decided to reuse existing
3231
- * delta from a pack. "reuse_delta &&" is implied.
3232
- */
3233
- continue ;
3234
-
3235
- if (!entry -> type_valid ||
3236
- oe_size_less_than (& to_pack , entry , 50 ))
3256
+ if (!should_attempt_deltas (entry ))
3237
3257
continue ;
3238
3258
3239
- if (entry -> no_try_delta )
3240
- continue ;
3241
-
3242
- if (!entry -> preferred_base ) {
3259
+ if (!entry -> preferred_base )
3243
3260
nr_deltas ++ ;
3244
- if (oe_type (entry ) < 0 )
3245
- die (_ ("unable to get type of object %s" ),
3246
- oid_to_hex (& entry -> idx .oid ));
3247
- } else {
3248
- if (oe_type (entry ) < 0 ) {
3249
- /*
3250
- * This object is not found, but we
3251
- * don't have to include it anyway.
3252
- */
3253
- continue ;
3254
- }
3255
- }
3256
3261
3257
3262
delta_list [n ++ ] = entry ;
3258
3263
}
0 commit comments