Skip to content

Commit dfcd905

Browse files
committed
Merge branch 'jc/deprecate-pack-redundant'
Warn loudly when the "pack-redundant" command, which has been left stale with almost unusable performance issues, gets used, as we no longer want to recommend its use (instead just "repack -d" instead). * jc/deprecate-pack-redundant: pack-redundant: gauge the usage before proposing its removal
2 parents c7b1aaf + c3b5847 commit dfcd905

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

builtin/pack-redundant.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,7 @@ static void load_all(void)
560560
int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
561561
{
562562
int i;
563+
int i_still_use_this = 0;
563564
struct pack_list *min = NULL, *red, *pl;
564565
struct llist *ignore;
565566
struct object_id *oid;
@@ -586,12 +587,24 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
586587
alt_odb = 1;
587588
continue;
588589
}
590+
if (!strcmp(arg, "--i-still-use-this")) {
591+
i_still_use_this = 1;
592+
continue;
593+
}
589594
if (*arg == '-')
590595
usage(pack_redundant_usage);
591596
else
592597
break;
593598
}
594599

600+
if (!i_still_use_this) {
601+
fputs(_("'git pack-redundant' is nominated for removal.\n"
602+
"If you still use this command, please add an extra\n"
603+
"option, '--i-still-use-this', on the command line\n"
604+
"and let us know you still use it by sending an e-mail\n"
605+
"to <[email protected]>. Thanks.\n"), stderr);
606+
}
607+
595608
if (load_all_packs)
596609
load_all();
597610
else

t/t5323-pack-redundant.sh

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ relationship between packs and objects is as follows:
3939
master_repo=master.git
4040
shared_repo=shared.git
4141

42+
git_pack_redundant='git pack-redundant --i-still-use-this'
43+
4244
# Create commits in <repo> and assign each commit's oid to shell variables
4345
# given in the arguments (A, B, and C). E.g.:
4446
#
@@ -118,7 +120,7 @@ test_expect_success 'master: pack-redundant works with no packfile' '
118120
cat >expect <<-EOF &&
119121
fatal: Zero packs found!
120122
EOF
121-
test_must_fail git pack-redundant --all >actual 2>&1 &&
123+
test_must_fail $git_pack_redundant --all >actual 2>&1 &&
122124
test_cmp expect actual
123125
)
124126
'
@@ -146,7 +148,7 @@ test_expect_success 'master: pack-redundant works with one packfile' '
146148
EOF
147149
(
148150
cd "$master_repo" &&
149-
git pack-redundant --all >out &&
151+
$git_pack_redundant --all >out &&
150152
test_must_be_empty out
151153
)
152154
'
@@ -183,7 +185,7 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
183185
EOF
184186
(
185187
cd "$master_repo" &&
186-
git pack-redundant --all >out &&
188+
$git_pack_redundant --all >out &&
187189
test_must_be_empty out
188190
)
189191
'
@@ -221,7 +223,7 @@ test_expect_success 'master: one of pack-2/pack-3 is redundant' '
221223
cat >expect <<-EOF &&
222224
P3:$P3
223225
EOF
224-
git pack-redundant --all >out &&
226+
$git_pack_redundant --all >out &&
225227
format_packfiles <out >actual &&
226228
test_cmp expect actual
227229
)
@@ -260,7 +262,7 @@ test_expect_success 'master: pack 2, 4, and 6 are redundant' '
260262
P4:$P4
261263
P6:$P6
262264
EOF
263-
git pack-redundant --all >out &&
265+
$git_pack_redundant --all >out &&
264266
format_packfiles <out >actual &&
265267
test_cmp expect actual
266268
)
@@ -295,7 +297,7 @@ test_expect_success 'master: pack-8 (subset of pack-1) is also redundant' '
295297
P6:$P6
296298
P8:$P8
297299
EOF
298-
git pack-redundant --all >out &&
300+
$git_pack_redundant --all >out &&
299301
format_packfiles <out >actual &&
300302
test_cmp expect actual
301303
)
@@ -313,9 +315,9 @@ test_expect_success 'master: clean loose objects' '
313315
test_expect_success 'master: remove redundant packs and pass fsck' '
314316
(
315317
cd "$master_repo" &&
316-
git pack-redundant --all | xargs rm &&
318+
$git_pack_redundant --all | xargs rm &&
317319
git fsck &&
318-
git pack-redundant --all >out &&
320+
$git_pack_redundant --all >out &&
319321
test_must_be_empty out
320322
)
321323
'
@@ -333,7 +335,7 @@ test_expect_success 'setup shared.git' '
333335
test_expect_success 'shared: all packs are redundant, but no output without --alt-odb' '
334336
(
335337
cd "$shared_repo" &&
336-
git pack-redundant --all >out &&
338+
$git_pack_redundant --all >out &&
337339
test_must_be_empty out
338340
)
339341
'
@@ -372,7 +374,7 @@ test_expect_success 'shared: show redundant packs in stderr for verbose mode' '
372374
P5:$P5
373375
P7:$P7
374376
EOF
375-
git pack-redundant --all --verbose >out 2>out.err &&
377+
$git_pack_redundant --all --verbose >out 2>out.err &&
376378
test_must_be_empty out &&
377379
grep "pack$" out.err | format_packfiles >actual &&
378380
test_cmp expect actual
@@ -385,9 +387,9 @@ test_expect_success 'shared: remove redundant packs, no packs left' '
385387
cat >expect <<-EOF &&
386388
fatal: Zero packs found!
387389
EOF
388-
git pack-redundant --all --alt-odb | xargs rm &&
390+
$git_pack_redundant --all --alt-odb | xargs rm &&
389391
git fsck &&
390-
test_must_fail git pack-redundant --all --alt-odb >actual 2>&1 &&
392+
test_must_fail $git_pack_redundant --all --alt-odb >actual 2>&1 &&
391393
test_cmp expect actual
392394
)
393395
'
@@ -415,7 +417,7 @@ test_expect_success 'shared: create new objects and packs' '
415417
test_expect_success 'shared: no redundant without --alt-odb' '
416418
(
417419
cd "$shared_repo" &&
418-
git pack-redundant --all >out &&
420+
$git_pack_redundant --all >out &&
419421
test_must_be_empty out
420422
)
421423
'
@@ -446,7 +448,7 @@ test_expect_success 'shared: no redundant without --alt-odb' '
446448
test_expect_success 'shared: one pack is redundant with --alt-odb' '
447449
(
448450
cd "$shared_repo" &&
449-
git pack-redundant --all --alt-odb >out &&
451+
$git_pack_redundant --all --alt-odb >out &&
450452
format_packfiles <out >actual &&
451453
test_line_count = 1 actual
452454
)
@@ -483,7 +485,7 @@ test_expect_success 'shared: ignore unique objects and all two packs are redunda
483485
Px1:$Px1
484486
Px2:$Px2
485487
EOF
486-
git pack-redundant --all --alt-odb >out <<-EOF &&
488+
$git_pack_redundant --all --alt-odb >out <<-EOF &&
487489
$X
488490
$Y
489491
$Z

0 commit comments

Comments
 (0)