threads / patch / 8024

patchChange all git-status output to be "comments"

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

## tl;dr

2 messages between May 8, 2007 and May 8, 2007. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Shawn O. Pearce· May 8, 2007, 02:13 UTC · lore

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(-)
Show changes to wt-status.c +4 −4
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
Junio C Hamano· May 8, 2007, 21:07 UTC · re: Shawn O. Pearce · lore

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

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 14 quoted lines
> 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.

I think a better change would be to remove the 'nothing to commit' when recording a merge. The tool strongly discourage creating an empty commit (iow, "diff-tree it^ it" is empty) for a single parent case, while a merge that ends up (even when you did not use "ours" strategy but resolved "fixing the same bug, but differently" conflicts by hand) nullifying everything the other side did is a perfectly normal merge.

I do not have a strong feeling against saying '# ' in front of 'nothing to commit' in the non-merge cases, other than that the current one makes the 'nothing to commit' message itself stand out in 'git status' output. There also is a small issue of updating the documentation and retraining people. We need to grep and replace them in the documentation and tutorial, and start telling people who learn older copies of documentation google finds that the older git said things slightly differently.

← back to recent threads