Fix git commit-tree invokation for git v1.7.1
[puppet-git.git] / ppg-init-dev
blob506572a439875affdf4df3297971517a253dd4f0
1 #!/bin/bash
3 if [[ -n "${PPG_DEBUG}" ]]; then
4 set -x
5 fi
7 GIT_DIR=$(git rev-parse --git-dir)
9 if [ -z "$GIT_DIR" ]; then
10 echo >&2 "Not in a git checkout"
11 exit 1
14 cat << 'EOF' > $GIT_DIR/hooks/pre-commit.tmp$$
15 #!/bin/sh
17 if [ -z "$PPG_COMMIT" ]; then
18 echo >&2 On this repository, use ppg commit instead of git commit
19 exit 1
22 EOF
24 if ! cmp $GIT_DIR/hooks/pre-commit $GIT_DIR/hooks/pre-commit.tmp$$ ; then
25 cp $GIT_DIR/hooks/pre-commit{,.backup-$(date +%Y%m%d%H%M)}
26 mv $GIT_DIR/hooks/pre-commit.tmp$$ $GIT_DIR/hooks/pre-commit
28 chmod ugo+x $GIT_DIR/hooks/pre-commit