summaryrefslogtreecommitdiff
path: root/wt-status.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-02-12 00:45:18 -0500
committerJunio C Hamano <gitster@pobox.com>2008-02-13 13:54:58 -0800
commitff58b9aaf8bf4ce7471a21baa502cb9ddaa9873a (patch)
treef4469b2de8595c87f687a151ab75e1e615666499 /wt-status.c
parent077b725f0bbe2b6ca2deb569c22a6f0d7a374dd3 (diff)
downloadgit-ff58b9aaf8bf4ce7471a21baa502cb9ddaa9873a.tar.gz
status: suggest "git rm --cached" to unstage for initial commit
It makes no sense to suggest "git reset HEAD" since we have no HEAD commit. This actually used to work but regressed in f26a0012. wt_status_print_cached_header was updated to take the whole wt_status struct rather than just the reference field. Previously the various code paths were sometimes sending in s->reference and sometimes sending in NULL, making the decision on whether this was an initial commit before we even got to this function. Now we must check the initial flag here. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wt-status.c')
-rw-r--r--wt-status.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wt-status.c b/wt-status.c
index bfd1b0fcc6..991e373785 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -60,7 +60,7 @@ static void wt_status_print_cached_header(struct wt_status *s)
{
const char *c = color(WT_STATUS_HEADER);
color_fprintf_ln(s->fp, c, "# Changes to be committed:");
- if (s->reference) {
+ if (!s->is_initial) {
color_fprintf_ln(s->fp, c, "# (use \"git reset %s <file>...\" to unstage)", s->reference);
} else {
color_fprintf_ln(s->fp, c, "# (use \"git rm --cached <file>...\" to unstage)");