aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/isgr8
1 files changed, 8 insertions, 0 deletions
diff --git a/bin/isgr b/bin/isgr
new file mode 100755
index 00000000..9cb37c1a
--- /dev/null
+++ b/bin/isgr
@@ -0,0 +1,8 @@
+#!/bin/sh
+# Return an exit status for whether the current directory appears to be in a
+# Git working copy
+exec >/dev/null 2>&1
+cd -- "${1:-.}" || exit
+git symbolic-ref --quiet HEAD ||
+git rev-parse --short HEAD ||
+exit 1