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

Re: [PATCH] When nothing to git-commit, honor the git-status color setting.

From
Brian Hetro <whee@smaertness.net>
Date
Aug 27, 2007, 16:15 UTC
Message-ID
<20070827161517.GA25484@ruiner>
In-Reply-To
<20070827101509.GB23248@coredump.intra.peff.net>
On Mon, Aug 27, 2007 at 06:15:09 -0400, Jeff King wrote:
Show 7 quoted lines
> On Mon, Aug 27, 2007 at 05:45:43AM -0400, Brian Hetro wrote:
> 
> > I was thinking more along the lines of "use color as if you had run
> > git-status" when I decided on $use_status_color.  Perhaps there is a
> > better name.
> 
> I wonder if the implementation below is slightly more readable.

I do prefer your implementation. There is no need to depend on status_only here.

> I am starting a queue of such patches that I care about and will
> re-send after the release.
Please do.
Show 30 quoted lines
> ---
> diff --git a/git-commit.sh b/git-commit.sh
> index d7e7028..96cec04 100755
> --- a/git-commit.sh
> +++ b/git-commit.sh
> @@ -13,6 +13,7 @@ git rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t
>  case "$0" in
>  *status)
>  	status_only=t
> +	no_override_color=t
>  	;;
>  *commit)
>  	status_only=
> @@ -49,7 +50,7 @@ run_status () {
>  		export GIT_INDEX_FILE
>  	fi
>  
> -	case "$status_only" in
> +	case "$no_override_color" in
>  	t) color= ;;
>  	*) color=--nocolor ;;
>  	esac
> @@ -556,7 +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"
> -	run_status
> +	no_override_color=t run_status
>  	exit 1
>  fi
Previous: Jeff King
Message 5 of 5 in “When nothing to git-commit, honor the git-status color setting.”
  1. When nothing to git-commit, honor the git-status color setting.Brian Hetro, Aug 26, 2007
  2. Jeff KingAug 27, 2007
  3. Brian HetroAug 27, 2007
  4. Jeff KingAug 27, 2007
  5. Brian HetroAug 27, 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.