@@ -3196,6 +3196,36 @@ 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
+ /* This happens if we decided to reuse existing
3203
+ * delta from a pack. "reuse_delta &&" is implied.
3204
+ */
3205
+ return 0 ;
3206
+
3207
+ if (!entry -> type_valid ||
3208
+ oe_size_less_than (& to_pack , entry , 50 ))
3209
+ return 0 ;
3210
+
3211
+ if (entry -> no_try_delta )
3212
+ return 0 ;
3213
+
3214
+ if (!entry -> preferred_base ) {
3215
+ if (oe_type (entry ) < 0 )
3216
+ die (_ ("unable to get type of object %s" ),
3217
+ oid_to_hex (& entry -> idx .oid ));
3218
+ } else if (oe_type (entry ) < 0 ) {
3219
+ /*
3220
+ * This object is not found, but we
3221
+ * don't have to include it anyway.
3222
+ */
3223
+ return 0 ;
3224
+ }
3225
+
3226
+ return 1 ;
3227
+ }
3228
+
3199
3229
static void prepare_pack (int window , int depth )
3200
3230
{
3201
3231
struct object_entry * * delta_list ;
@@ -3226,33 +3256,11 @@ static void prepare_pack(int window, int depth)
3226
3256
for (i = 0 ; i < to_pack .nr_objects ; i ++ ) {
3227
3257
struct object_entry * entry = to_pack .objects + i ;
3228
3258
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 ))
3259
+ if (!should_attempt_deltas (entry ))
3237
3260
continue ;
3238
3261
3239
- if (entry -> no_try_delta )
3240
- continue ;
3241
-
3242
- if (!entry -> preferred_base ) {
3262
+ if (!entry -> preferred_base )
3243
3263
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
3264
3257
3265
delta_list [n ++ ] = entry ;
3258
3266
}
0 commit comments