scalar: teach diagnose to gather packfile info

It's helpful to see if there are other crud files in the pack
directory. Let's teach the `scalar diagnose` command to gather
file size information about pack files.

While at it, also enumerate the pack files in the alternate
object directories, if any are registered.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Matthew John Cheetham
2022-05-28 16:11:17 -07:00
committed by Junio C Hamano
parent 0ed5b13f24
commit 93e804b278
2 changed files with 35 additions and 1 deletions

View File

@ -101,6 +101,8 @@ test_expect_success '`scalar [...] <dir>` errors out when dir is missing' '
SQ="'"
test_expect_success UNZIP 'scalar diagnose' '
scalar clone "file://$(pwd)" cloned --single-branch &&
git repack &&
echo "$(pwd)/.git/objects/" >>cloned/src/.git/objects/info/alternates &&
scalar diagnose cloned >out 2>err &&
grep "Available space" out &&
sed -n "s/.*$SQ\\(.*\\.zip\\)$SQ.*/\\1/p" <err >zip_path &&
@ -110,7 +112,9 @@ test_expect_success UNZIP 'scalar diagnose' '
folder=${zip_path%.zip} &&
test_path_is_missing "$folder" &&
unzip -p "$zip_path" diagnostics.log >out &&
test_file_not_empty out
test_file_not_empty out &&
unzip -p "$zip_path" packs-local.txt >out &&
grep "$(pwd)/.git/objects" out
'
test_done