summaryrefslogtreecommitdiffstats
path: root/log-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-08-26 20:10:22 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-26 20:10:23 +0200
commit9a7bd3d0cb2b08b29edfe51b61893dc6856e74f0 (patch)
treef68989d11d7f850219f7a50945b0275525a07d61 /log-tree.c
parentMerge branch 'ss/packed-ref-store-leakfix' into maint-2.46 (diff)
parentlog-tree: use decimal_width() (diff)
downloadgit-9a7bd3d0cb2b08b29edfe51b61893dc6856e74f0.tar.xz
git-9a7bd3d0cb2b08b29edfe51b61893dc6856e74f0.zip
Merge branch 'rs/use-decimal-width' into maint-2.46
Code clean-up. * rs/use-decimal-width: log-tree: use decimal_width()
Diffstat (limited to 'log-tree.c')
-rw-r--r--log-tree.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/log-tree.c b/log-tree.c
index 52feec4356..13524bc888 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -31,6 +31,7 @@
#include "tree.h"
#include "wildmatch.h"
#include "write-or-die.h"
+#include "pager.h"
static struct decoration name_decoration = { "object names" };
static int decoration_loaded;
@@ -411,16 +412,6 @@ void show_decorations(struct rev_info *opt, struct commit *commit)
strbuf_release(&sb);
}
-static unsigned int digits_in_number(unsigned int number)
-{
- unsigned int i = 10, result = 1;
- while (i <= number) {
- i *= 10;
- result++;
- }
- return result;
-}
-
void fmt_output_subject(struct strbuf *filename,
const char *subject,
struct rev_info *info)
@@ -464,7 +455,7 @@ void fmt_output_email_subject(struct strbuf *sb, struct rev_info *opt)
strbuf_addf(sb, "Subject: [%s%s%0*d/%d] ",
opt->subject_prefix,
*opt->subject_prefix ? " " : "",
- digits_in_number(opt->total),
+ decimal_width(opt->total),
opt->nr, opt->total);
} else if (opt->total == 0 && opt->subject_prefix && *opt->subject_prefix) {
strbuf_addf(sb, "Subject: [%s] ",