@@ -3283,6 +3283,33 @@ static int add_ref_tag(const char *tag UNUSED, const char *referent UNUSED, cons
3283
3283
return 0 ;
3284
3284
}
3285
3285
3286
+ static int should_attempt_deltas (struct object_entry * entry )
3287
+ {
3288
+ if (DELTA (entry ))
3289
+ return 0 ;
3290
+
3291
+ if (!entry -> type_valid ||
3292
+ oe_size_less_than (& to_pack , entry , 50 ))
3293
+ return 0 ;
3294
+
3295
+ if (entry -> no_try_delta )
3296
+ return 0 ;
3297
+
3298
+ if (!entry -> preferred_base ) {
3299
+ if (oe_type (entry ) < 0 )
3300
+ die (_ ("unable to get type of object %s" ),
3301
+ oid_to_hex (& entry -> idx .oid ));
3302
+ } else if (oe_type (entry ) < 0 ) {
3303
+ /*
3304
+ * This object is not found, but we
3305
+ * don't have to include it anyway.
3306
+ */
3307
+ return 0 ;
3308
+ }
3309
+
3310
+ return 1 ;
3311
+ }
3312
+
3286
3313
static void prepare_pack (int window , int depth )
3287
3314
{
3288
3315
struct object_entry * * delta_list ;
@@ -3313,33 +3340,11 @@ static void prepare_pack(int window, int depth)
3313
3340
for (i = 0 ; i < to_pack .nr_objects ; i ++ ) {
3314
3341
struct object_entry * entry = to_pack .objects + i ;
3315
3342
3316
- if (DELTA (entry ))
3317
- /* This happens if we decided to reuse existing
3318
- * delta from a pack. "reuse_delta &&" is implied.
3319
- */
3320
- continue ;
3321
-
3322
- if (!entry -> type_valid ||
3323
- oe_size_less_than (& to_pack , entry , 50 ))
3343
+ if (!should_attempt_deltas (entry ))
3324
3344
continue ;
3325
3345
3326
- if (entry -> no_try_delta )
3327
- continue ;
3328
-
3329
- if (!entry -> preferred_base ) {
3346
+ if (!entry -> preferred_base )
3330
3347
nr_deltas ++ ;
3331
- if (oe_type (entry ) < 0 )
3332
- die (_ ("unable to get type of object %s" ),
3333
- oid_to_hex (& entry -> idx .oid ));
3334
- } else {
3335
- if (oe_type (entry ) < 0 ) {
3336
- /*
3337
- * This object is not found, but we
3338
- * don't have to include it anyway.
3339
- */
3340
- continue ;
3341
- }
3342
- }
3343
3348
3344
3349
delta_list [n ++ ] = entry ;
3345
3350
}
0 commit comments