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>
This commit is contained in:

committed by
Junio C Hamano

parent
67aca456a3
commit
09b0d9dde0
@ -49,10 +49,11 @@ run_status () {
|
|||||||
export GIT_INDEX_FILE
|
export GIT_INDEX_FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$status_only" in
|
if test "$status_only" = "t" -o "$use_status_color" = "t"; then
|
||||||
t) color= ;;
|
color=
|
||||||
*) color=--nocolor ;;
|
else
|
||||||
esac
|
color=--nocolor
|
||||||
|
fi
|
||||||
git runstatus ${color} \
|
git runstatus ${color} \
|
||||||
${verbose:+--verbose} \
|
${verbose:+--verbose} \
|
||||||
${amend:+--amend} \
|
${amend:+--amend} \
|
||||||
@ -556,6 +557,7 @@ fi
|
|||||||
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
|
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
|
||||||
then
|
then
|
||||||
rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
|
rm -f "$GIT_DIR/COMMIT_EDITMSG" "$GIT_DIR/SQUASH_MSG"
|
||||||
|
use_status_color=t
|
||||||
run_status
|
run_status
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user