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