All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Hetro <whee@smaertness.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] When nothing to git-commit, honor the git-status color setting.
Date: Sun, 26 Aug 2007 14:35:26 -0400	[thread overview]
Message-ID: <20070826183526.GA16359@ruiner> (raw)

Instead of disabling color all of the time during a git-commit, allow
the user's config preference in the situation where there is nothing
to commit.  In this situation, the status is printed to the terminal
and not sent to COMMIT_EDITMSG, so honoring the status color setting
is expected.

Signed-off-by: Brian Hetro <whee@smaertness.net>
---
 git-commit.sh |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/git-commit.sh b/git-commit.sh
index d7e7028..1d04f1f 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -49,10 +49,11 @@ run_status () {
 		export GIT_INDEX_FILE
 	fi
 
-	case "$status_only" in
-	t) color= ;;
-	*) color=--nocolor ;;
-	esac
+	if test "$status_only" = "t" -o "$use_status_color" = "t"; then
+		color=
+	else
+		color=--nocolor
+	fi
 	git runstatus ${color} \
 		${verbose:+--verbose} \
 		${amend:+--amend} \
@@ -556,6 +557,7 @@ fi
 if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
 then
 	rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
+	use_status_color=t
 	run_status
 	exit 1
 fi
-- 
1.5.3.rc6.23.g0058-dirty

             reply	other threads:[~2007-08-26 18:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-26 18:35 Brian Hetro [this message]
2007-08-27  8:25 ` [PATCH] When nothing to git-commit, honor the git-status color setting Jeff King
2007-08-27  9:45   ` Brian Hetro
2007-08-27 10:15     ` Jeff King
2007-08-27 16:15       ` Brian Hetro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070826183526.GA16359@ruiner \
    --to=whee@smaertness.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.