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