]> snippets.scripts.mit.edu Git - Scripts/git/.git/commitdiff
zephyr-post-receive: fix quoting and tabs
authorAlex Dehnert <adehnert@mit.edu>
Sat, 2 Feb 2013 23:59:17 +0000 (18:59 -0500)
committerAlex Dehnert <adehnert@mit.edu>
Sat, 2 Feb 2013 23:59:17 +0000 (18:59 -0500)
git-hooks/zephyr-post-receive

index d0c6f448c7393a1c8f3be8d419f2b598d21f00f3..6feebad3b11690a2e78d985e3d74615f61dae2ed 100755 (executable)
@@ -61,15 +61,16 @@ while read oldrev newrev refname; do
     check_max
     shortrev=`git log -1 --pretty=format:%h "$rev"`
     lines=`git show -M "$rev" | wc -l`
     check_max
     shortrev=`git log -1 --pretty=format:%h "$rev"`
     lines=`git show -M "$rev" | wc -l`
-    cmd="git show --stat -M $usecolor $rev"
     if [ $lines -lt $maxlines ]; then
     if [ $lines -lt $maxlines ]; then
-       cmd="git show -M $usecolor $rev"
+        stat=""
+    else
+        stat="--stat"
     fi
     fi
-    ($cmd |
+    (git show -M $stat $usecolor "$rev" |
      sed -e 's/@/@@/g' \
          -e 's/}/@(})/g' \
          -e 's/\e\[m/}@{/g' \
      sed -e 's/@/@@/g' \
          -e 's/}/@(})/g' \
          -e 's/\e\[m/}@{/g' \
-        -e 's/\e\[1m/}@b{/g' \
+         -e 's/\e\[1m/}@b{/g' \
          -e 's/\e\[33m/@color(yellow)/g' \
          -e 's/\e\[31m/@color(red)/g' \
          -e 's/\e\[32m/@color(green)/g' \
          -e 's/\e\[33m/@color(yellow)/g' \
          -e 's/\e\[31m/@color(red)/g' \
          -e 's/\e\[32m/@color(green)/g' \