mirror of
https://github.com/git/git
synced 2024-08-27 03:29:21 +00:00
Merge branch 'jx/pack-redundant-on-single-pack'
"git pack-redandant" when there is only one packfile used to crash, which has been corrected. * jx/pack-redundant-on-single-pack: pack-redundant: fix crash when one packfile in repo
This commit is contained in:
commit
c46f849f8a
|
@ -473,6 +473,12 @@ static void cmp_local_packs(void)
|
||||||
{
|
{
|
||||||
struct pack_list *subset, *pl = local_packs;
|
struct pack_list *subset, *pl = local_packs;
|
||||||
|
|
||||||
|
/* only one packfile */
|
||||||
|
if (!pl->next) {
|
||||||
|
llist_init(&pl->unique_objects);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
while ((subset = pl)) {
|
while ((subset = pl)) {
|
||||||
while ((subset = subset->next))
|
while ((subset = subset->next))
|
||||||
cmp_two_packs(pl, subset);
|
cmp_two_packs(pl, subset);
|
||||||
|
|
|
@ -112,6 +112,45 @@ test_expect_success 'setup master repo' '
|
||||||
create_commits_in "$master_repo" A B C D E F G H I J K L M N O P Q R
|
create_commits_in "$master_repo" A B C D E F G H I J K L M N O P Q R
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'master: pack-redundant works with no packfile' '
|
||||||
|
(
|
||||||
|
cd "$master_repo" &&
|
||||||
|
cat >expect <<-EOF &&
|
||||||
|
fatal: Zero packs found!
|
||||||
|
EOF
|
||||||
|
test_must_fail git pack-redundant --all >actual 2>&1 &&
|
||||||
|
test_cmp expect actual
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Chart of packs and objects for this test case
|
||||||
|
#
|
||||||
|
# | T A B C D E F G H I J K L M N O P Q R
|
||||||
|
# ----+--------------------------------------
|
||||||
|
# P1 | x x x x x x x x
|
||||||
|
# ----+--------------------------------------
|
||||||
|
# ALL | x x x x x x x x
|
||||||
|
#
|
||||||
|
#############################################################################
|
||||||
|
test_expect_success 'master: pack-redundant works with one packfile' '
|
||||||
|
create_pack_in "$master_repo" P1 <<-EOF &&
|
||||||
|
$T
|
||||||
|
$A
|
||||||
|
$B
|
||||||
|
$C
|
||||||
|
$D
|
||||||
|
$E
|
||||||
|
$F
|
||||||
|
$R
|
||||||
|
EOF
|
||||||
|
(
|
||||||
|
cd "$master_repo" &&
|
||||||
|
git pack-redundant --all >out &&
|
||||||
|
test_must_be_empty out
|
||||||
|
)
|
||||||
|
'
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Chart of packs and objects for this test case
|
# Chart of packs and objects for this test case
|
||||||
#
|
#
|
||||||
|
@ -125,16 +164,6 @@ test_expect_success 'setup master repo' '
|
||||||
#
|
#
|
||||||
#############################################################################
|
#############################################################################
|
||||||
test_expect_success 'master: no redundant for pack 1, 2, 3' '
|
test_expect_success 'master: no redundant for pack 1, 2, 3' '
|
||||||
create_pack_in "$master_repo" P1 <<-EOF &&
|
|
||||||
$T
|
|
||||||
$A
|
|
||||||
$B
|
|
||||||
$C
|
|
||||||
$D
|
|
||||||
$E
|
|
||||||
$F
|
|
||||||
$R
|
|
||||||
EOF
|
|
||||||
create_pack_in "$master_repo" P2 <<-EOF &&
|
create_pack_in "$master_repo" P2 <<-EOF &&
|
||||||
$B
|
$B
|
||||||
$C
|
$C
|
||||||
|
|
Loading…
Reference in a new issue