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

[PATCH 2/2] wt-status: take advice.statusHints seriously

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Apr 22, 2010, 20:30 UTC
Message-ID
<86a4d8e5df80008c5c2b3ff4f2a5842ad1f58dc4.1271968072.git.git@drmicha.warpmail.net>
In-Reply-To
<7v39yo53mt.fsf@alter.siamese.dyndns.org>

Currently, status gives a lot of hints even when advice.statusHints is false. Change this so that all hints depend on the config variable.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
---
 t/t7508-status.sh |    2 +-
 wt-status.c       |   21 +++++++++++++++------
 2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 7409a06..1301ec8 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -151,7 +151,7 @@ cat >expect <<EOF
 # Changed but not updated:
 #	modified:   dir1/modified
 #
-# Untracked files not listed (use -u option to show untracked files)
+# Untracked files not listed
 EOF
 git config advice.statusHints false
 test_expect_success 'status -uno (advice.statusHints false)' '
diff --git a/wt-status.c b/wt-status.c
index 8ca59a2..d44486c 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -625,7 +625,9 @@ void wt_status_print(struct wt_status *s)
 	if (s->show_untracked_files)
 		wt_status_print_untracked(s);
 	else if (s->commitable)
-		 fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
+		fprintf(s->fp, "# Untracked files not listed%s\n",
+			advice_status_hints
+			? " (use -u option to show untracked files)" : "");
 
 	if (s->verbose)
 		wt_status_print_verbose(s);
@@ -635,15 +637,22 @@ void wt_status_print(struct wt_status *s)
 		else if (s->nowarn)
 			; /* nothing */
 		else if (s->workdir_dirty)
-			printf("no changes added to commit (use \"git add\" and/or \"git commit -a\")\n");
+			printf("no changes added to commit%s\n",
+				advice_status_hints
+				? " (use \"git add\" and/or \"git commit -a\")" : "");
 		else if (s->untracked.nr)
-			printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
+			printf("nothing added to commit but untracked files present%s\n",
+				advice_status_hints
+				? " (use \"git add\" to track)" : "");
 		else if (s->is_initial)
-			printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
+			printf("nothing to commit%s\n", advice_status_hints
+				? " (create/copy files and use \"git add\" to track)" : "");
 		else if (!s->show_untracked_files)
-			printf("nothing to commit (use -u to show untracked files)\n");
+			printf("nothing to commit%s\n", advice_status_hints
+				? " (use -u to show untracked files)" : "");
 		else
-			printf("nothing to commit (working directory clean)\n");
+			printf("nothing to commit%s\n", advice_status_hints
+				? " (working directory clean)" : "");
 	}
 }
 
-- 
1.7.1.rc1.248.gcefbb
Previous: Michael J GruberNext: Tay Ray Chuan
Message 4 of 9 in “[RFC/RFD] wt-status: take advice.statusHints seriously”
  1. Michael J GruberApr 21, 2010
  2. Junio C HamanoApr 22, 2010
  3. 1/2 t7508: test advice.statusHintsMichael J Gruber, Apr 22, 2010
  4. 2/2 wt-status: take advice.statusHints seriouslyMichael J Gruber, Apr 22, 2010
  5. Tay Ray ChuanApr 23, 2010
  6. Michael J GruberApr 23, 2010
  7. Jakub NarebskiApr 23, 2010
  8. Jeff KingApr 26, 2010
  9. Jeff KingApr 26, 2010

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.