Make Git colors work in zwgc.
authorAnders Kaseorg <andersk@mit.edu>
Wed, 25 Feb 2009 22:16:09 +0000 (17:16 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Wed, 25 Feb 2009 22:16:09 +0000 (17:16 -0500)
git-hooks/zephyr-post-receive

index 19260d7bd1de7afe682699fc35ebcfaa2618ba37..7e06b30b72578ed000690b663b4b1674047ac82d 100755 (executable)
@@ -28,11 +28,14 @@ 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 $usecolor "$rev" |
-     sed "s/@/@@/g" |
-     sed "s/\e\[m/@color(default)/g" |
-     sed "s/\e\[33m/@color(yellow)/g" |
-     sed "s/\e\[31m/@color(red)/g" |
-     sed "s/\e\[32m/@color(green)/g") |
+     sed -e 's/@/@@/g' \
+         -e 's/}/@(})/g' \
+         -e 's/\e\[m/}@{/g' \
+         -e 's/\e\[33m/@color(yellow)/g' \
+         -e 's/\e\[31m/@color(red)/g' \
+         -e 's/\e\[32m/@color(green)/g' \
+         -e '1s/^/@{/' \
+         -e '$s/$/}/') |
     zwrite -c "$class" -i "${instance:-$shortrev}" -s "${zsig:-Git}: $refname" -d
   done
 done