[gst-cvs] gstreamer: gst-indent: Use the same logic to find gnuindent as the git hook

Jan Schmidt thaytan at kemper.freedesktop.org
Wed Nov 4 03:41:30 PST 2009


Module: gstreamer
Branch: master
Commit: 35e1103446d521028a8c96bc3bda23c4a9b04931
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=35e1103446d521028a8c96bc3bda23c4a9b04931

Author: Jan Schmidt <thaytan at noraisin.net>
Date:   Wed Nov  4 01:54:36 2009 +0000

gst-indent: Use the same logic to find gnuindent as the git hook

---

 tools/gst-indent |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/tools/gst-indent b/tools/gst-indent
index 1d088f1..b3cff47 100755
--- a/tools/gst-indent
+++ b/tools/gst-indent
@@ -1,5 +1,29 @@
 #!/bin/sh
-indent \
+
+version=`gnuindent --version 2>/dev/null`
+if test "x$version" = "x"; then
+  version=`indent --version 2>/dev/null`
+  if test "x$version" = "x"; then
+    echo "GStreamer git pre-commit hook:"
+    echo "Did not find GNU indent, please install it before continuing."
+    exit 1
+  fi
+  INDENT=indent
+else
+  INDENT=gnuindent
+fi
+
+case `$INDENT --version` in
+  GNU*)
+      ;;
+  default)
+      echo "Did not find GNU indent, please install it before continuing."
+      echo "(Found $INDENT, but it doesn't seem to be GNU indent)"
+      exit 1
+      ;;
+esac
+
+$INDENT \
   --braces-on-if-line \
   --case-brace-indentation0 \
   --case-indentation2 \





More information about the Gstreamer-commits mailing list