Re: [PATCH v3 7/7] builtin/repo: add object disk size info to structure table
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Dec 16, 2025, 08:25 UTC
- Message-ID
- <aUEXeuCkMDWSfwHi@pks.im>
- In-Reply-To
- <20251215205639.2700270-8-jltobler@gmail.com>
On Mon, Dec 15, 2025 at 02:56:39PM -0600, Justin Tobler wrote:
Show 25 quoted lines
> diff --git a/t/t1901-repo-structure.sh b/t/t1901-repo-structure.sh
> index dd17caad05..64db191234 100755
> --- a/t/t1901-repo-structure.sh
> +++ b/t/t1901-repo-structure.sh
> @@ -5,8 +5,18 @@ 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 [ "$2" = "true" ]; then
> + disk_usage_opt="--disk-usage=human"
> + fi
> +
> + if [ "$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' 'We don't use `if [ ... ]` in our codebase, and we typically have the `then` on the next line:
if test "$2" = "true"
then
...
fi if test "$1" = "all"
then
...
else
...
fiShow 10 quoted lines
> @@ -79,6 +94,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
Curious, but why is the last one special here?
Patrick