Skip to content

Commit

Permalink
When nothing to git-commit, honor the git-status color setting.
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Brian Hetro authored and Junio C Hamano committed Aug 26, 2007
1 parent 67aca45 commit 09b0d9d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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} \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 09b0d9d

Please sign in to comment.