Skip to content

Commit 612942a

Browse files
Ossegitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9d530dc commit 612942a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

wt-status.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,11 +948,17 @@ static int stash_count_refs(struct object_id *ooid, struct object_id *noid,
948948
return 0;
949949
}
950950

951+
static int count_stash_entries(void)
952+
{
953+
int n = 0;
954+
for_each_reflog_ent("refs/stash", stash_count_refs, &n);
955+
return n;
956+
}
957+
951958
static void wt_longstatus_print_stash_summary(struct wt_status *s)
952959
{
953-
int stash_count = 0;
960+
int stash_count = count_stash_entries();
954961

955-
for_each_reflog_ent("refs/stash", stash_count_refs, &stash_count);
956962
if (stash_count > 0)
957963
status_printf_ln(s, GIT_COLOR_NORMAL,
958964
Q_("Your stash currently has %d entry",

0 commit comments

Comments
 (0)