Last active
July 1, 2019 20:59
-
-
Save snoe925/eba3b8c24085b6ed9141785fd696c07b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
git config core.repositoryformatversion >/dev/null | |
if [ $? -ne 0 ]; then | |
echo "Not a git repository" >&2 | |
exit 1 | |
fi | |
if [ "$1" = "enable" ]; then | |
ORIGPATH=$PWD | |
# Back through (..) our full cwd until we find the repo base directory with .git/ in it. | |
while [ "$REPOPATH" = "" ] ; do | |
if [ -d .git ] ; then | |
REPOPATH=$PWD | |
elif [ "$PWD" = "/" ]; then | |
REPOPATH=/ | |
else | |
cd .. | |
fi | |
done | |
HOOKFILE="$REPOPATH/.git/hooks/post-commit" | |
if [ ! -f "$HOOKFILE" ]; then | |
curl -s -L "https://raw.githubusercontent.com/flightaware/zeitgit/master/hooks/post-commit" >"$HOOKFILE" | |
chmod a+x "$HOOKFILE" | |
fi | |
git config zeitgit.enabled true | |
if [ "$2" != "" ]; then | |
git config zeitgit.receiveremail $2 | |
else | |
git config zeitgit.receiveremail gitcommit@flightaware.com | |
fi | |
cd "$ORIGPATH" | |
elif [ "$1" = "disable" ]; then | |
git config zeitgit.enabled false | |
else | |
echo "Usage: `basename $0` enable [email@example.com]" | |
echo " `basename $0` disable" | |
exit 1 | |
fi | |
echo "Zeitgit configuration:" | |
git config -l | grep -i zeitgit | sed 's/^/ /' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment