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>
This commit is contained in:
parent
9d530dc002
commit
612942a1d2
10
wt-status.c
10
wt-status.c
@ -948,11 +948,17 @@ static int stash_count_refs(struct object_id *ooid, struct object_id *noid,
|
|||||||
return 0;
|
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)
|
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)
|
if (stash_count > 0)
|
||||||
status_printf_ln(s, GIT_COLOR_NORMAL,
|
status_printf_ln(s, GIT_COLOR_NORMAL,
|
||||||
Q_("Your stash currently has %d entry",
|
Q_("Your stash currently has %d entry",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user