diff options
| Commit | 47f1595e49218f016179aab2e39207fe203da54a (patch) | |
|---|---|---|
| Author | 2026-09-27 22:04:57 +0300 | |
| Committer | 2026-09-27 22:14:30 +0300 | |
| Files | 402fc2e3e97b6545c2a53502c9e1c47199dfdb89 /ui-tree.c | |
| cgit-47f1595e49218f016179aab2e39207fe203da54a.tar cgit-47f1595e49218f016179aab2e39207fe203da54a.tar.gz cgit-47f1595e49218f016179aab2e39207fe203da54a.zip | ||
| Parent | 81a502f3f6579c6d69dab2485bdbc4fc35d9748c (diff) | |
ui-tree: Human-readable file sizes
1 files changed, 9 insertions, 1 deletions
| -rw-r--r-- | ui-tree.c | 10 |
@@ -257,7 +257,15 @@ static int ls_item(const struct object_id *oid, struct strbuf *base, free(buf); strbuf_release(&linkpath); } - htmlf("</td><td class='ls-size'>%li</td>", size); + + if (size < 1024) + htmlf("</td><td class='ls-size'>%li B</td>", size); + else if (size < 1048576) + htmlf("</td><td class='ls-size'>%.1f KiB</td>", (double)size / 1024); + else if (size < 1073741824) + htmlf("</td><td class='ls-size'>%.1f MiB</td>", (double)size / 1048576); + else + htmlf("</td><td class='ls-size'>%.1f GiB</td>", (double)size / 1073741824); html("<td>"); cgit_log_link("log", NULL, "button", ctx.qry.head, |
