@@ -1293,15 +1293,26 @@ static int compare_by_mtime(const void *a_, const void *b_)
1293
1293
return 0 ;
1294
1294
}
1295
1295
1296
- static int fill_included_packs_all (struct multi_pack_index * m ,
1296
+ static int fill_included_packs_all (struct repository * r ,
1297
+ struct multi_pack_index * m ,
1297
1298
unsigned char * include_pack )
1298
1299
{
1299
- uint32_t i ;
1300
+ uint32_t i , count = 0 ;
1301
+ int pack_kept_objects = 0 ;
1302
+
1303
+ repo_config_get_bool (r , "repack.packkeptobjects" , & pack_kept_objects );
1304
+
1305
+ for (i = 0 ; i < m -> num_packs ; i ++ ) {
1306
+ if (prepare_midx_pack (r , m , i ))
1307
+ continue ;
1308
+ if (!pack_kept_objects && m -> packs [i ]-> pack_keep )
1309
+ continue ;
1300
1310
1301
- for (i = 0 ; i < m -> num_packs ; i ++ )
1302
1311
include_pack [i ] = 1 ;
1312
+ count ++ ;
1313
+ }
1303
1314
1304
- return m -> num_packs < 2 ;
1315
+ return count < 2 ;
1305
1316
}
1306
1317
1307
1318
static int fill_included_packs_batch (struct repository * r ,
@@ -1312,6 +1323,9 @@ static int fill_included_packs_batch(struct repository *r,
1312
1323
uint32_t i , packs_to_repack ;
1313
1324
size_t total_size ;
1314
1325
struct repack_info * pack_info = xcalloc (m -> num_packs , sizeof (struct repack_info ));
1326
+ int pack_kept_objects = 0 ;
1327
+
1328
+ repo_config_get_bool (r , "repack.packkeptobjects" , & pack_kept_objects );
1315
1329
1316
1330
for (i = 0 ; i < m -> num_packs ; i ++ ) {
1317
1331
pack_info [i ].pack_int_id = i ;
@@ -1338,6 +1352,8 @@ static int fill_included_packs_batch(struct repository *r,
1338
1352
1339
1353
if (!p )
1340
1354
continue ;
1355
+ if (!pack_kept_objects && p -> pack_keep )
1356
+ continue ;
1341
1357
if (open_pack_index (p ) || !p -> num_objects )
1342
1358
continue ;
1343
1359
@@ -1370,6 +1386,14 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
1370
1386
struct strbuf base_name = STRBUF_INIT ;
1371
1387
struct multi_pack_index * m = load_multi_pack_index (object_dir , 1 );
1372
1388
1389
+ /*
1390
+ * When updating the default for these configuration
1391
+ * variables in builtin/repack.c, these must be adjusted
1392
+ * to match.
1393
+ */
1394
+ int delta_base_offset = 1 ;
1395
+ int use_delta_islands = 0 ;
1396
+
1373
1397
if (!m )
1374
1398
return 0 ;
1375
1399
@@ -1378,15 +1402,23 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
1378
1402
if (batch_size ) {
1379
1403
if (fill_included_packs_batch (r , m , include_pack , batch_size ))
1380
1404
goto cleanup ;
1381
- } else if (fill_included_packs_all (m , include_pack ))
1405
+ } else if (fill_included_packs_all (r , m , include_pack ))
1382
1406
goto cleanup ;
1383
1407
1408
+ repo_config_get_bool (r , "repack.usedeltabaseoffset" , & delta_base_offset );
1409
+ repo_config_get_bool (r , "repack.usedeltaislands" , & use_delta_islands );
1410
+
1384
1411
argv_array_push (& cmd .args , "pack-objects" );
1385
1412
1386
1413
strbuf_addstr (& base_name , object_dir );
1387
1414
strbuf_addstr (& base_name , "/pack/pack" );
1388
1415
argv_array_push (& cmd .args , base_name .buf );
1389
1416
1417
+ if (delta_base_offset )
1418
+ argv_array_push (& cmd .args , "--delta-base-offset" );
1419
+ if (use_delta_islands )
1420
+ argv_array_push (& cmd .args , "--delta-islands" );
1421
+
1390
1422
if (flags & MIDX_PROGRESS )
1391
1423
argv_array_push (& cmd .args , "--progress" );
1392
1424
else
0 commit comments