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