aboutsummaryrefslogtreecommitdiffstats
path: root/wt-status.c
diff options
context:
space:
mode:
authorØystein Walle <oystwa@gmail.com>2021-10-22 00:25:31 +0200
committerJunio C Hamano <gitster@pobox.com>2021-10-21 17:24:30 -0700
commit612942a1d201d33c2e952c89d58e5c6d26a028a2 (patch)
treebd4f76664b1ff872bc267cfeb42492bf466dfb46 /wt-status.c
parent9d530dc0024503ab4218fe6c4395b8a0aa245478 (diff)
downloadgit-612942a1d201d33c2e952c89d58e5c6d26a028a2.tar.gz
status: count stash entries in separate function
Make the counting of stash entries contained in one simple function as it will be used in the next commit. Signed-off-by: Øystein Walle <oystwa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/wt-status.c b/wt-status.c
index e4f29b2b4c..6c3edcdb45 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -948,11 +948,17 @@ static int stash_count_refs(struct object_id *ooid, struct object_id *noid,
return 0;
}
+static int count_stash_entries(void)
+{
+ int n = 0;
+ for_each_reflog_ent("refs/stash", stash_count_refs, &n);
+ return n;
+}
+
static void wt_longstatus_print_stash_summary(struct wt_status *s)
{
- int stash_count = 0;
+ int stash_count = count_stash_entries();
- for_each_reflog_ent("refs/stash", stash_count_refs, &stash_count);
if (stash_count > 0)
status_printf_ln(s, GIT_COLOR_NORMAL,
Q_("Your stash currently has %d entry",