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

[PATCH] Change all git-status output to be "comments"

From
Shawn O. Pearce <spearce@spearce.org>
Date
May 8, 2007, 02:13 UTC
Message-ID
<20070508021355.GA22383@spearce.org>

You wouldn't believe how many of my merge commits end with the following message from git-status:

  "nothing to commit (working directory clean)"

This happens because of the way I sometimes create (and resolve) some types of merges. My commit message buffer gets prepped with the output of git-status, which has this nice message way down at the bottom of the file, below a large-ish block of lines that start with "#". Since git-commit strips those lines, I always fail to see the trailing line that doesn't start with "#" and consequently fail to see that "nothing to commit ..." will be part of my merge message.

So always comment out the output of git-status.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 wt-status.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index a055990..a9ba1ae 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -336,13 +336,13 @@ void wt_status_print(struct wt_status *s)
 		if (s->amend)
 			printf("# No changes\n");
 		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 (use \"git add\" and/or \"git commit -a\")\n");
 		else if (s->workdir_untracked)
-			printf("nothing added to commit but untracked files present (use \"git add\" to track)\n");
+			printf("# nothing added to commit but untracked files present (use \"git add\" to track)\n");
 		else if (s->is_initial)
-			printf("nothing to commit (create/copy files and use \"git add\" to track)\n");
+			printf("# nothing to commit (create/copy files and use \"git add\" to track)\n");
 		else
-			printf("nothing to commit (working directory clean)\n");
+			printf("# nothing to commit (working directory clean)\n");
 	}
 }
 
-- 
1.5.2.rc2.716.gba45c
Next: Junio C Hamano
Message 1 of 2 in “Change all git-status output to be "comments"”
  1. Change all git-status output to be "comments"Shawn O. Pearce, May 8, 2007
  2. Junio C HamanoMay 8, 2007

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.