summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJürgen Rühle <j-r@online.de>2007-01-02 20:26:21 +0100
committerJunio C Hamano <junkio@cox.net>2007-01-02 23:43:50 -0800
commit3c1eb9cb2d57769f770ddc36fd6b49706608ebb7 (patch)
tree391a440a9052f920ef0144f48464d4bf96f4f225 /wt-status.c
parent98bf8a47c296f51ea9722fef4bb81dbfb70cd4bb (diff)
downloadgit-3c1eb9cb2d57769f770ddc36fd6b49706608ebb7.tar.gz
Improve cached content header of status output
This tries to be more to the point while also including a pointer on how to unstage changes from the index. Since this header is printed in two different code paths and the name of the reference commit is needed for the unstage part, provide a new printing function. Signed-off-by: Jürgen Rühle <j-r@online.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/wt-status.c b/wt-status.c
index 9b777a569e..8aac526440 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -53,6 +53,18 @@ void wt_status_prepare(struct wt_status *s)
s->workdir_clean = 1;
}
+static void wt_status_print_cached_header(const char *reference)
+{
+ const char *c = color(WT_STATUS_HEADER);
+ color_printf_ln(c, "# Cached changes to be committed:");
+ if (reference) {
+ color_printf_ln(c, "# (use \"git reset %s <file>...\" and \"git rm --cached <file>...\" to unstage)", reference);
+ } else {
+ color_printf_ln(c, "# (use \"git rm --cached <file>...\" to unstage)");
+ }
+ color_printf_ln(c, "#");
+}
+
static void wt_status_print_header(const char *main, const char *sub)
{
const char *c = color(WT_STATUS_HEADER);
@@ -147,8 +159,7 @@ static void wt_status_print_updated_cb(struct diff_queue_struct *q,
if (q->queue[i]->status == 'U')
continue;
if (!shown_header) {
- wt_status_print_header("Added but not yet committed",
- "will commit");
+ wt_status_print_cached_header(s->reference);
s->commitable = 1;
shown_header = 1;
}
@@ -182,8 +193,7 @@ void wt_status_print_initial(struct wt_status *s)
read_cache();
if (active_nr) {
s->commitable = 1;
- wt_status_print_header("Added but not yet committed",
- "will commit");
+ wt_status_print_cached_header(NULL);
}
for (i = 0; i < active_nr; i++) {
color_printf(color(WT_STATUS_HEADER), "#\t");