summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/wt-status.c b/wt-status.c
index e4f29b2..335e723 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",
@@ -1212,17 +1218,23 @@ static void show_merge_in_progress(struct wt_status *s,
static void show_am_in_progress(struct wt_status *s,
const char *color)
{
+ int am_empty_patch;
+
status_printf_ln(s, color,
_("You are in the middle of an am session."));
if (s->state.am_empty_patch)
status_printf_ln(s, color,
_("The current patch is empty."));
if (s->hints) {
- if (!s->state.am_empty_patch)
+ am_empty_patch = s->state.am_empty_patch;
+ if (!am_empty_patch)
status_printf_ln(s, color,
_(" (fix conflicts and then run \"git am --continue\")"));
status_printf_ln(s, color,
_(" (use \"git am --skip\" to skip this patch)"));
+ if (am_empty_patch)
+ status_printf_ln(s, color,
+ _(" (use \"git am --allow-empty\" to record this patch as an empty commit)"));
status_printf_ln(s, color,
_(" (use \"git am --abort\" to restore the original branch)"));
}
@@ -2177,6 +2189,18 @@ static void wt_porcelain_v2_print_tracking(struct wt_status *s)
}
/*
+ * Print the stash count in a porcelain-friendly format
+ */
+static void wt_porcelain_v2_print_stash(struct wt_status *s)
+{
+ int stash_count = count_stash_entries();
+ char eol = s->null_termination ? '\0' : '\n';
+
+ if (stash_count > 0)
+ fprintf(s->fp, "# stash %d%c", stash_count, eol);
+}
+
+/*
* Convert various submodule status values into a
* fixed-length string of characters in the buffer provided.
*/
@@ -2437,6 +2461,9 @@ static void wt_porcelain_v2_print(struct wt_status *s)
if (s->show_branch)
wt_porcelain_v2_print_tracking(s);
+ if (s->show_stash)
+ wt_porcelain_v2_print_stash(s);
+
for (i = 0; i < s->change.nr; i++) {
it = &(s->change.items[i]);
d = it->util;