From 67cecc693f511321b9d96eead24fd42e6a5c0cdc Mon Sep 17 00:00:00 2001 From: Justin Tobler Date: Wed, 17 Dec 2025 11:54:03 -0600 Subject: 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 Signed-off-by: Junio C Hamano --- t/t1901-repo-structure.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 't') 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 && -- cgit v1.3-5-g9baa