diff options
author | Li Linchao <lilinchao@oschina.cn> | 2022-08-11 06:47:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-08-11 22:45:23 +0200 |
commit | 9096451acdf065c3dbcf609dcefe51cd68aa5d1e (patch) | |
tree | 4df703b0f464aa042bb3b4f590d215f55bcf13ec /t/t6115-rev-list-du.sh | |
parent | Sync with Git 2.37.2 (diff) | |
download | git-9096451acdf065c3dbcf609dcefe51cd68aa5d1e.tar.xz git-9096451acdf065c3dbcf609dcefe51cd68aa5d1e.zip |
rev-list: support human-readable output for `--disk-usage`
The '--disk-usage' option for git-rev-list was introduced in 16950f8384
(rev-list: add --disk-usage option for calculating disk usage, 2021-02-09).
This is very useful for people inspect their git repo's objects usage
infomation, but the resulting number is quit hard for a human to read.
Teach git rev-list to output a human readable result when using
'--disk-usage'.
Signed-off-by: Li Linchao <lilinchao@oschina.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rwxr-xr-x | t/t6115-rev-list-du.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t6115-rev-list-du.sh b/t/t6115-rev-list-du.sh index b4aef32b71..d59111dede 100755 --- a/t/t6115-rev-list-du.sh +++ b/t/t6115-rev-list-du.sh @@ -48,4 +48,26 @@ check_du HEAD check_du --objects HEAD check_du --objects HEAD^..HEAD +# As mentioned above, don't use hardcode sizes as actual size, but use the +# output from git cat-file. +test_expect_success 'rev-list --disk-usage=human' ' + git rev-list --objects HEAD --disk-usage=human >actual && + disk_usage_slow --objects HEAD >actual_size && + grep "$(cat actual_size) bytes" actual +' + +test_expect_success 'rev-list --disk-usage=human with bitmaps' ' + git rev-list --objects HEAD --use-bitmap-index --disk-usage=human >actual && + disk_usage_slow --objects HEAD >actual_size && + grep "$(cat actual_size) bytes" actual +' + +test_expect_success 'rev-list use --disk-usage unproperly' ' + test_must_fail git rev-list --objects HEAD --disk-usage=typo 2>err && + cat >expect <<-\EOF && + fatal: invalid value for '\''--disk-usage=<format>'\'': '\''typo'\'', the only allowed format is '\''human'\'' + EOF + test_cmp err expect +' + test_done |