#!/bin/sh
#
# isgr - return exit status for whether dir appears to be in a Git working copy

# no output, at all, ever; this is intended for use in scripting
exec >/dev/null 2>&1

# enter the given directory (default to current directory)
cd -- "${1:-.}" || exit

# if neither of these commands work, this isn't a Git repository
git symbolic-ref --quiet HEAD || git rev-parse --short HEAD
