]> snippets.scripts.mit.edu Git - Scripts/git/.git/commitdiff
Add a 'zephyr.color' config setting.
authorNelson Elhage <nelhage@mit.edu>
Wed, 25 Feb 2009 21:24:38 +0000 (16:24 -0500)
committerNelson Elhage <nelhage@mit.edu>
Wed, 25 Feb 2009 21:24:38 +0000 (16:24 -0500)
This defaults to "true" if unspecified for backwards compatibility.

git-hooks/zephyr-post-receive

index f148d17e8ffa112764f42808660a725944f1992b..19260d7bd1de7afe682699fc35ebcfaa2618ba37 100755 (executable)
 class=`git config zephyr.class`
 instance=`git config zephyr.instance`
 zsig=`git config zephyr.zsig`
+color=`git config --bool zephyr.color`
+
+if [ "${color:-true}" = "true" ]; then
+    usecolor="--color"
+else
+    usecolor=""
+fi
+
 if [ -z "$class" ]; then
   echo "I don't know where to send a commit zephyr!" >&2
   echo "Please set the zephyr.class config variable in" >&2
@@ -19,7 +27,7 @@ fi
 while read oldrev newrev refname; do
   git-rev-list --reverse "$oldrev..$newrev" | while read rev; do
     shortrev=`git log -1 --pretty=format:%h "$rev"`
-    (git show --stat --color "$rev" |
+    (git show --stat $usecolor "$rev" |
      sed "s/@/@@/g" |
      sed "s/\e\[m/@color(default)/g" |
      sed "s/\e\[33m/@color(yellow)/g" |