summaryrefslogtreecommitdiff
path: root/t/t5323-pack-redundant.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2020-12-23 13:59:46 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2020-12-23 13:59:46 -0800
commitc46f849f8a2050776688bee408dabc813a44a5c7 (patch)
tree5fbeb0473145c1176c1ffa135c376650b2673be0 /t/t5323-pack-redundant.sh
parentGit 2.30-rc1 (diff)
parentpack-redundant: fix crash when one packfile in repo (diff)
downloadtgif-c46f849f8a2050776688bee408dabc813a44a5c7.tar.xz
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
Diffstat (limited to 't/t5323-pack-redundant.sh')
-rwxr-xr-xt/t5323-pack-redundant.sh37
1 files changed, 33 insertions, 4 deletions
diff --git a/t/t5323-pack-redundant.sh b/t/t5323-pack-redundant.sh
index 6b4d1ca353..7e3340843f 100755
--- a/t/t5323-pack-redundant.sh
+++ b/t/t5323-pack-redundant.sh
@@ -112,19 +112,28 @@ 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
'
+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
-# P2 | x x x x x x x
-# P3 | x x x x x x
# ----+--------------------------------------
-# ALL | x x x x x x x x x x x x x x x
+# ALL | x x x x x x x x
#
#############################################################################
-test_expect_success 'master: no redundant for pack 1, 2, 3' '
+test_expect_success 'master: pack-redundant works with one packfile' '
create_pack_in "$master_repo" P1 <<-EOF &&
$T
$A
@@ -135,6 +144,26 @@ test_expect_success 'master: no redundant for pack 1, 2, 3' '
$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
+#
+# | 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
+# P2 | x x x x x x x
+# P3 | x x x x x x
+# ----+--------------------------------------
+# ALL | x x x x x x x x x x x x x x x
+#
+#############################################################################
+test_expect_success 'master: no redundant for pack 1, 2, 3' '
create_pack_in "$master_repo" P2 <<-EOF &&
$B
$C