summaryrefslogtreecommitdiff
path: root/git-commit.sh
diff options
context:
space:
mode:
authorBrian Hetro <whee@smaertness.net>2007-08-26 18:35:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-08-26 21:01:47 (GMT)
commit09b0d9dde03df1432df06dcfcc20d8abecccb860 (patch)
tree3d85f89c331676127c524ec21ec0789f838a2d51 /git-commit.sh
parent67aca456a3cfa9ab8420a6e171d8eee7b0ad2209 (diff)
downloadgit-09b0d9dde03df1432df06dcfcc20d8abecccb860.zip
git-09b0d9dde03df1432df06dcfcc20d8abecccb860.tar.gz
git-09b0d9dde03df1432df06dcfcc20d8abecccb860.tar.bz2
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>
Diffstat (limited to 'git-commit.sh')
-rwxr-xr-xgit-commit.sh10
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