22 lines
436 B
Bash
Executable file
22 lines
436 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
current_path=$(realpath $0)
|
|
hook_base=${current_path%/*}
|
|
|
|
if [[ -e $hook_base/data/install ]]; then
|
|
echo "Pinch already installed" >&2
|
|
exit 1
|
|
fi
|
|
|
|
old_cfg=$(git config --global --get core.hooksPath)
|
|
hooks_path=$hook_base/hooks
|
|
|
|
if [ ! $? -eq 0 ]; then
|
|
echo $old_cfg >$hook_base/data/old_cfg
|
|
fi
|
|
|
|
git config --global core.hooksPath $hooks_path
|
|
|
|
echo $(date +%s) >$hook_base/data/install
|
|
|
|
echo "Pinch installed."
|