I have written script to ZIP last commit on post-commit
hook:
#!/bin/sh
echo "[post-commit] Commit done!"
exec < /dev/tty
while true; do
read -p "[post-commit] Archive this commit? (Y/n) " yn
if [ "$yn" = "" ]; then
yn='Y'
fi
case $yn in
[Yy] ) exec git archive -o $(git log -1 --pretty=%B).zip $(git rev-parse HEAD) $(git diff --name-only $(git rev-parse HEAD)^..$(git rev-parse HEAD)); break;;
[Nn] ) exit;;
* ) echo "Please answer Yy or Nn for yes or no.";;
esac
done
It's creating a ZIP file but .. empty, it's not storing changed files...
Anyone see where is bad?