aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJustin Tobler <jltobler@gmail.com>2025-12-17 11:54:03 -0600
committerJunio C Hamano <gitster@pobox.com>2025-12-18 09:02:32 +0900
commit67cecc693f511321b9d96eead24fd42e6a5c0cdc (patch)
tree353c9d289d7771ebfcf15849001d1d07700dae2c /t
parent4d279ae36b1d0f68c8a7ba9b986ff9690ddc1af9 (diff)
downloadgit-67cecc693f511321b9d96eead24fd42e6a5c0cdc.tar.xz
builtin/repo: add disk size info to keyvalue stucture output
Similar to a prior commit, extend the keyvalue and nul output formats of the git-repo(1) structure command to additionally provide info regarding total object disk sizes by object type. Signed-off-by: Justin Tobler <jltobler@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1901-repo-structure.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh
index b18213c660..dd17caad05 100755
--- a/t/t1901-repo-structure.sh
+++ b/t/t1901-repo-structure.sh
@@ -4,6 +4,11 @@ test_description='test git repo structure'
. ./test-lib.sh
+object_type_disk_usage() {
+ git rev-list --all --objects --disk-usage --filter=object:type=$1 \
+ --filter-provided-objects
+}
+
test_expect_success 'empty repository' '
test_when_finished "rm -rf repo" &&
git init repo &&
@@ -91,7 +96,7 @@ test_expect_success SHA1 'keyvalue and nul format' '
test_commit_bulk 42 &&
git tag -a foo -m bar &&
- cat >expect <<-\EOF &&
+ cat >expect <<-EOF &&
references.branches.count=1
references.tags.count=1
references.remotes.count=0
@@ -104,6 +109,10 @@ test_expect_success SHA1 'keyvalue and nul format' '
objects.trees.inflated_size=28554
objects.blobs.inflated_size=453
objects.tags.inflated_size=132
+ objects.commits.disk_size=$(object_type_disk_usage commit)
+ objects.trees.disk_size=$(object_type_disk_usage tree)
+ objects.blobs.disk_size=$(object_type_disk_usage blob)
+ objects.tags.disk_size=$(object_type_disk_usage tag)
EOF
git repo structure --format=keyvalue >out 2>err &&