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