@matheusbsbs / matheus-bagliano / commits / 09b0d9dde0
Fork 0

When nothing to git-commit, honor the git-status color setting.

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>

Brian Hetro committed Aug 26, 2007 at 14:35 UTC 09b0d9dde03df1432df06dcfcc20d8abecccb860
1 file changed +6 -4
git-commit.sh
+6 -4
@@ -49,10 +49,11 @@ run_status () {
49 export GIT_INDEX_FILE
50 fi
51
52 - case "$status_only" in
53 - t) color= ;;
54 - *) color=--nocolor ;;
55 - esac
52 + if test "$status_only" = "t" -o "$use_status_color" = "t"; then
53 + color=
54 + else
55 + color=--nocolor
56 + fi
57 git runstatus ${color} \
58 ${verbose:+--verbose} \
59 ${amend:+--amend} \
@@ -556,6 +557,7 @@ fi
557 if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
558 then
559 rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
560 + use_status_color=t
561 run_status
562 exit 1
563 fi