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

[PATCH 2/6] git commit --dry-run -v: show diff in color when asked

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 15, 2009, 10:06 UTC
Message-ID
<1250330803-22171-3-git-send-email-gitster@pobox.com>
In-Reply-To
<1250330803-22171-2-git-send-email-gitster@pobox.com>

The earlier implementation of --dry-run didn't duplicate the use of color "git status -v" set up for diff output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Fixes what is already queued in 'next'.
 builtin-commit.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 1c200eb..200ffda 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -979,9 +979,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
 	argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
 					  prefix, &s);
-	if (dry_run)
+	if (dry_run) {
+		if (diff_use_color_default == -1)
+			diff_use_color_default = git_use_color_default;
 		return dry_run_commit(argc, argv, prefix, &s);
-
+	}
 	index_file = prepare_index(argc, argv, prefix, 0);
 
 	/* Set up everything for writing the commit object.  This includes
-- 
1.6.4.224.g3be84
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 10 in “"git commit --dry-run" updates”
  1. 0/6 "git commit --dry-run" updatesJunio C Hamano, Aug 15, 2009
  2. 1/6 Documentation/git-commit.txt: describe --dry-runJunio C Hamano, Aug 15, 2009
  3. 2/6 git commit --dry-run -v: show diff in color when askedJunio C Hamano, Aug 15, 2009
  4. 3/6 git stat: the beginningJunio C Hamano, Aug 15, 2009
  5. 4/6 git stat: pathspec limits, unlike traditional "git status"Junio C Hamano, Aug 15, 2009
  6. 5/6 git stat -s: short status outputJunio C Hamano, Aug 15, 2009
  7. 6/6 git status: not "commit --dry-run" anymoreJunio C Hamano, Aug 15, 2009
  8. Thomas RastAug 17, 2009
  9. Junio C HamanoAug 17, 2009
  10. Thomas RastAug 17, 2009

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.