From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Rhodes, Kate" <masukomi@gmail.com>, git@vger.kernel.org
Subject: Re: [Bug] git-status shows bad instructions prior to first commit
Date: Tue, 12 Feb 2008 00:45:18 -0500 [thread overview]
Message-ID: <20080212054518.GA24817@sigill.intra.peff.net> (raw)
In-Reply-To: <7vzlu66f5g.fsf@gitster.siamese.dyndns.org>
On Mon, Feb 11, 2008 at 07:13:15PM -0800, Junio C Hamano wrote:
> "Rhodes, Kate" <masukomi@gmail.com> writes:
>
> > While we're at it, can someone please explain to me how to remove a
> > file from the index prior to the first commit? I'm stumped.
>
> rm --cached
And indeed, some clever person already made this distinction in the
git-status output, but it has been broken for a while. I'm not sure this
is worth a test now that it is fixed (but such a test _would_ have
caught this); I can make one if you like.
-- >8 --
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>
---
wt-status.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index 27b946d..b5ae98d 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)");
--
1.5.4.1215.gf7da-dirty
next prev parent reply other threads:[~2008-02-12 5:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-12 0:59 [Bug] git-status shows bad instructions prior to first commit Rhodes, Kate
2008-02-12 3:13 ` Junio C Hamano
2008-02-12 5:45 ` Jeff King [this message]
2008-02-13 22:02 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080212054518.GA24817@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=masukomi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).