summaryrefslogtreecommitdiff
path: root/t/helper/test-read-cache.c
diff options
context:
space:
mode:
authorLibravatar Joel Holdsworth <jholdsworth@nvidia.com>2021-12-19 15:40:27 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-12-20 12:55:09 -0800
commitae9b9509a76e49cbf4fb254b2b75d566be6434a8 (patch)
treeb79a318190e3cf0372e100c135b207105c95b048 /t/helper/test-read-cache.c
parentGit 2.34.1 (diff)
downloadtgif-ae9b9509a76e49cbf4fb254b2b75d566be6434a8.tar.xz
git-p4: print size values in appropriate units
The git-p4 script reports file sizes in various log messages. Previously, in each case the script would print them as the number of bytes divided by 1048576 i.e. the size in mebibytes, rounded down to an integer. This resulted in small files being described as having a size of "0 MB". This patch replaces the existing behaviour with a new helper function: format_size_human_readable, which takes a number of bytes (or any other quantity), and computes the appropriate prefix to use: none, Ki, Mi, Gi, Ti, Pi, Ei, Zi, Yi. For example, a size of 123456 will now be printed as "120.6 KiB" greatly improving the readability of the log output. Large valued prefixes such as pebi, exbi, zebi and yobi are included for completeness, though they not expected to appear in any real-world Perforce repository! Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/helper/test-read-cache.c')
0 files changed, 0 insertions, 0 deletions