git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Bug] git-status shows bad instructions prior to first commit

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 13, 2008, 22:02 UTC
Message-ID
<7vodako6qb.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20080212054518.GA24817@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 5 quoted lines
> 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.

In order to avoid regressing again, we must have something like this included in your change, which I squashed in.

This goes to 'maint'.  Thanks for the fix.
 t/t7502-status.sh |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/t/t7502-status.sh b/t/t7502-status.sh
index 9ce50ca..b64ce30 100755
--- a/t/t7502-status.sh
+++ b/t/t7502-status.sh
@@ -17,6 +17,9 @@ test_expect_success 'setup' '
 	: > dir1/tracked &&
 	: > dir1/modified &&
 	git add . &&
+
+	git status >output &&
+
 	test_tick &&
 	git commit -m initial &&
 	: > untracked &&
@@ -28,6 +31,12 @@ test_expect_success 'setup' '
 	git add dir2/added
 '
 
+test_expect_success 'status (1)' '
+
+	grep -e "use \"git rm --cached <file>\.\.\.\" to unstage" output
+
+'
+
 cat > expect << \EOF
 # On branch master
 # Changes to be committed:
@@ -51,7 +60,7 @@ cat > expect << \EOF
 #	untracked
 EOF
 
-test_expect_success 'status' '
+test_expect_success 'status (2)' '
 
 	git status > output &&
 	git diff expect output
Previous: Jeff King
Message 4 of 4 in “[Bug] git-status shows bad instructions prior to first commit”
  1. Rhodes, KateFeb 12, 2008
  2. Junio C HamanoFeb 12, 2008
  3. Jeff KingFeb 12, 2008
  4. Junio C HamanoFeb 13, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.