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
This commit is contained in:
commit
dfcd905069
@ -560,6 +560,7 @@ static void load_all(void)
|
|||||||
int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
|
int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int i_still_use_this = 0;
|
||||||
struct pack_list *min = NULL, *red, *pl;
|
struct pack_list *min = NULL, *red, *pl;
|
||||||
struct llist *ignore;
|
struct llist *ignore;
|
||||||
struct object_id *oid;
|
struct object_id *oid;
|
||||||
@ -586,12 +587,24 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix)
|
|||||||
alt_odb = 1;
|
alt_odb = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(arg, "--i-still-use-this")) {
|
||||||
|
i_still_use_this = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (*arg == '-')
|
if (*arg == '-')
|
||||||
usage(pack_redundant_usage);
|
usage(pack_redundant_usage);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!i_still_use_this) {
|
||||||
|
fputs(_("'git pack-redundant' is nominated for removal.\n"
|
||||||
|
"If you still use this command, please add an extra\n"
|
||||||
|
"option, '--i-still-use-this', on the command line\n"
|
||||||
|
"and let us know you still use it by sending an e-mail\n"
|
||||||
|
"to <git@vger.kernel.org>. Thanks.\n"), stderr);
|
||||||
|
}
|
||||||
|
|
||||||
if (load_all_packs)
|
if (load_all_packs)
|
||||||
load_all();
|
load_all();
|
||||||
else
|
else
|
||||||
|
@ -39,6 +39,8 @@ relationship between packs and objects is as follows:
|
|||||||
master_repo=master.git
|
master_repo=master.git
|
||||||
shared_repo=shared.git
|
shared_repo=shared.git
|
||||||
|
|
||||||
|
git_pack_redundant='git pack-redundant --i-still-use-this'
|
||||||
|
|
||||||
# Create commits in <repo> and assign each commit's oid to shell variables
|
# Create commits in <repo> and assign each commit's oid to shell variables
|
||||||
# given in the arguments (A, B, and C). E.g.:
|
# given in the arguments (A, B, and C). E.g.:
|
||||||
#
|
#
|
||||||
@ -118,7 +120,7 @@ test_expect_success 'master: pack-redundant works with no packfile' '
|
|||||||
cat >expect <<-EOF &&
|
cat >expect <<-EOF &&
|
||||||
fatal: Zero packs found!
|
fatal: Zero packs found!
|
||||||
EOF
|
EOF
|
||||||
test_must_fail git pack-redundant --all >actual 2>&1 &&
|
test_must_fail $git_pack_redundant --all >actual 2>&1 &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -146,7 +148,7 @@ test_expect_success 'master: pack-redundant works with one packfile' '
|
|||||||
EOF
|
EOF
|
||||||
(
|
(
|
||||||
cd "$master_repo" &&
|
cd "$master_repo" &&
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
test_must_be_empty out
|
test_must_be_empty out
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -183,7 +185,7 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
|
|||||||
EOF
|
EOF
|
||||||
(
|
(
|
||||||
cd "$master_repo" &&
|
cd "$master_repo" &&
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
test_must_be_empty out
|
test_must_be_empty out
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -221,7 +223,7 @@ test_expect_success 'master: one of pack-2/pack-3 is redundant' '
|
|||||||
cat >expect <<-EOF &&
|
cat >expect <<-EOF &&
|
||||||
P3:$P3
|
P3:$P3
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
format_packfiles <out >actual &&
|
format_packfiles <out >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
@ -260,7 +262,7 @@ test_expect_success 'master: pack 2, 4, and 6 are redundant' '
|
|||||||
P4:$P4
|
P4:$P4
|
||||||
P6:$P6
|
P6:$P6
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
format_packfiles <out >actual &&
|
format_packfiles <out >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
@ -295,7 +297,7 @@ test_expect_success 'master: pack-8 (subset of pack-1) is also redundant' '
|
|||||||
P6:$P6
|
P6:$P6
|
||||||
P8:$P8
|
P8:$P8
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
format_packfiles <out >actual &&
|
format_packfiles <out >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
@ -313,9 +315,9 @@ test_expect_success 'master: clean loose objects' '
|
|||||||
test_expect_success 'master: remove redundant packs and pass fsck' '
|
test_expect_success 'master: remove redundant packs and pass fsck' '
|
||||||
(
|
(
|
||||||
cd "$master_repo" &&
|
cd "$master_repo" &&
|
||||||
git pack-redundant --all | xargs rm &&
|
$git_pack_redundant --all | xargs rm &&
|
||||||
git fsck &&
|
git fsck &&
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
test_must_be_empty out
|
test_must_be_empty out
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -333,7 +335,7 @@ test_expect_success 'setup shared.git' '
|
|||||||
test_expect_success 'shared: all packs are redundant, but no output without --alt-odb' '
|
test_expect_success 'shared: all packs are redundant, but no output without --alt-odb' '
|
||||||
(
|
(
|
||||||
cd "$shared_repo" &&
|
cd "$shared_repo" &&
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
test_must_be_empty out
|
test_must_be_empty out
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -372,7 +374,7 @@ test_expect_success 'shared: show redundant packs in stderr for verbose mode' '
|
|||||||
P5:$P5
|
P5:$P5
|
||||||
P7:$P7
|
P7:$P7
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all --verbose >out 2>out.err &&
|
$git_pack_redundant --all --verbose >out 2>out.err &&
|
||||||
test_must_be_empty out &&
|
test_must_be_empty out &&
|
||||||
grep "pack$" out.err | format_packfiles >actual &&
|
grep "pack$" out.err | format_packfiles >actual &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
@ -385,9 +387,9 @@ test_expect_success 'shared: remove redundant packs, no packs left' '
|
|||||||
cat >expect <<-EOF &&
|
cat >expect <<-EOF &&
|
||||||
fatal: Zero packs found!
|
fatal: Zero packs found!
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all --alt-odb | xargs rm &&
|
$git_pack_redundant --all --alt-odb | xargs rm &&
|
||||||
git fsck &&
|
git fsck &&
|
||||||
test_must_fail git pack-redundant --all --alt-odb >actual 2>&1 &&
|
test_must_fail $git_pack_redundant --all --alt-odb >actual 2>&1 &&
|
||||||
test_cmp expect actual
|
test_cmp expect actual
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -415,7 +417,7 @@ test_expect_success 'shared: create new objects and packs' '
|
|||||||
test_expect_success 'shared: no redundant without --alt-odb' '
|
test_expect_success 'shared: no redundant without --alt-odb' '
|
||||||
(
|
(
|
||||||
cd "$shared_repo" &&
|
cd "$shared_repo" &&
|
||||||
git pack-redundant --all >out &&
|
$git_pack_redundant --all >out &&
|
||||||
test_must_be_empty out
|
test_must_be_empty out
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
@ -446,7 +448,7 @@ test_expect_success 'shared: no redundant without --alt-odb' '
|
|||||||
test_expect_success 'shared: one pack is redundant with --alt-odb' '
|
test_expect_success 'shared: one pack is redundant with --alt-odb' '
|
||||||
(
|
(
|
||||||
cd "$shared_repo" &&
|
cd "$shared_repo" &&
|
||||||
git pack-redundant --all --alt-odb >out &&
|
$git_pack_redundant --all --alt-odb >out &&
|
||||||
format_packfiles <out >actual &&
|
format_packfiles <out >actual &&
|
||||||
test_line_count = 1 actual
|
test_line_count = 1 actual
|
||||||
)
|
)
|
||||||
@ -483,7 +485,7 @@ test_expect_success 'shared: ignore unique objects and all two packs are redunda
|
|||||||
Px1:$Px1
|
Px1:$Px1
|
||||||
Px2:$Px2
|
Px2:$Px2
|
||||||
EOF
|
EOF
|
||||||
git pack-redundant --all --alt-odb >out <<-EOF &&
|
$git_pack_redundant --all --alt-odb >out <<-EOF &&
|
||||||
$X
|
$X
|
||||||
$Y
|
$Y
|
||||||
$Z
|
$Z
|
||||||
|
Loading…
Reference in New Issue
Block a user