diff options
author | Antoine Pelisse <apelisse@gmail.com> | 2013-04-10 21:03:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-04-10 12:58:33 -0700 |
commit | 079b546a2940a84989893254a318c8414e13a13e (patch) | |
tree | 5f8cc69cbfa12a63cf23b6dfdd75f92eefb4b9ef /Documentation | |
parent | remote-bzr: improve tag handling (diff) | |
download | tgif-079b546a2940a84989893254a318c8414e13a13e.tar.xz |
strbuf: create strbuf_humanise_bytes() to show byte sizes
Humanization of downloaded size is done in the same function as text
formatting in 'process.c'. The code cannot be reused easily elsewhere.
Separate text formatting from size simplification and make the
function public in strbuf so that it can easily be used by other
callers.
We now can use strbuf_humanise_bytes() for both downloaded size and
download speed calculation. One of the drawbacks is that speed will
now look like this when download is stalled: "0 bytes/s" instead of
"0 KiB/s".
Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/technical/api-strbuf.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Documentation/technical/api-strbuf.txt b/Documentation/technical/api-strbuf.txt index 2c59cb2259..3350d97dda 100644 --- a/Documentation/technical/api-strbuf.txt +++ b/Documentation/technical/api-strbuf.txt @@ -230,6 +230,11 @@ which can be used by the programmer of the callback as she sees fit. destination. This is useful for literal data to be fed to either strbuf_expand or to the *printf family of functions. +`strbuf_humanise_bytes`:: + + Append the given byte size as a human-readable string (i.e. 12.23 KiB, + 3.50 MiB). + `strbuf_addf`:: Add a formatted string to the buffer. |