commit acafafc259281ec2def25a905b61e8b4eeaee524
parent 671c6e17a1a68cce132065b7636a4fc36858b289
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 24 May 2022 11:25:19 +0200
parent 671c6e17a1a68cce132065b7636a4fc36858b289
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 24 May 2022 11:25:19 +0200
writefilestree: print filesize for text-files in bytes and format bytes human-readable
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/stagit.c b/stagit.c @@ -1114,10 +1114,10 @@ writefilestree(FILE *fp, git_tree *tree, const char *path) fputs("\">", fp); xmlencode(fp, entryname, strlen(entryname)); fputs("</a></td><td class=\"num\" align=\"right\">", fp); - if (lc > 0) - fprintf(fp, "%zuL", lc); - else if (!is_obj_tree) - fprintf(fp, "%zuB", filesize); + if (!is_obj_tree) { + fprintf(fp, "%s", format_bytes(filesize)); + if (filesize < 1024) fputs(" ", fp); + } fputs("</td></tr>\n", fp); git_object_free(obj); } else if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT) {