diff options
| author | Justin Tobler <jltobler@gmail.com> | 2025-12-17 11:54:04 -0600 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2025-12-18 09:02:32 +0900 |
| commit | df1b071fedfddc322fa2a5e0f71d23cb05949d6f (patch) | |
| tree | fb571a9cd500b171adc29d2fb3b2338395d75bf6 /t | |
| parent | 67cecc693f511321b9d96eead24fd42e6a5c0cdc (diff) | |
| download | git-df1b071fedfddc322fa2a5e0f71d23cb05949d6f.tar.xz | |
builtin/repo: add object disk size info to structure table
Similar to a prior commit, update the table output format for the
git-repo(1) structure command to display the total object disk usage 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-x | t/t1901-repo-structure.sh | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh index dd17caad05..435fd979fa 100755 --- a/t/t1901-repo-structure.sh +++ b/t/t1901-repo-structure.sh @@ -5,8 +5,20 @@ 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 + disk_usage_opt="--disk-usage" + + if test "$2" = "true" + then + disk_usage_opt="--disk-usage=human" + fi + + if test "$1" = "all" + then + git rev-list --all --objects $disk_usage_opt + else + git rev-list --all --objects $disk_usage_opt \ + --filter=object:type=$1 --filter-provided-objects + fi } test_expect_success 'empty repository' ' @@ -35,6 +47,11 @@ test_expect_success 'empty repository' ' | * Trees | 0 B | | * Blobs | 0 B | | * Tags | 0 B | + | * Disk size | 0 B | + | * Commits | 0 B | + | * Trees | 0 B | + | * Blobs | 0 B | + | * Tags | 0 B | EOF git repo structure >out 2>err && @@ -58,7 +75,10 @@ test_expect_success SHA1 'repository with references and objects' ' # Also creates a commit, tree, and blob. git notes add -m foo && - cat >expect <<-\EOF && + # The tags disk size is handled specially due to the + # git-rev-list(1) --disk-usage=human option printing the full + # "byte/bytes" unit string instead of just "B". + cat >expect <<-EOF && | Repository structure | Value | | -------------------- | ---------- | | * References | | @@ -79,6 +99,11 @@ test_expect_success SHA1 'repository with references and objects' ' | * Trees | 15.81 MiB | | * Blobs | 11.68 KiB | | * Tags | 132 B | + | * Disk size | $(object_type_disk_usage all true) | + | * Commits | $(object_type_disk_usage commit true) | + | * Trees | $(object_type_disk_usage tree true) | + | * Blobs | $(object_type_disk_usage blob true) | + | * Tags | $(object_type_disk_usage tag) B | EOF git repo structure >out 2>err && |
