Blame .private/post-rewrite.sh

Packit 0a8e54
#!/bin/sh
Packit 0a8e54
#
Packit 0a8e54
# Detect amended commits and warn user if .amend is missing
Packit 0a8e54
#
Packit 0a8e54
# To have git run this script on commit, create a "post-rewrite" text file in
Packit 0a8e54
# .git/hooks/ with the following content:
Packit 0a8e54
# #!/bin/sh
Packit 0a8e54
# if [ -x .private/post-rewrite.sh ]; then
Packit 0a8e54
#   source .private/post-rewrite.sh
Packit 0a8e54
# fi
Packit 0a8e54
#
Packit 0a8e54
# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
Packit 0a8e54
# libusb development team and are NOT intended to solve versioning for any
Packit 0a8e54
# derivative branch, such as one you would create for private development.
Packit 0a8e54
#
Packit 0a8e54
Packit 0a8e54
case "$1" in
Packit 0a8e54
  amend)
Packit 0a8e54
    # Check if a .amend exists. If none, create one and warn user to re-commit.
Packit 0a8e54
    if [ -f .amend ]; then
Packit 0a8e54
      rm .amend
Packit 0a8e54
    else
Packit 0a8e54
      echo "Amend commit detected, but no .amend file - One has now been created."
Packit 0a8e54
      echo "Please re-commit as is (amend), so that the version number is correct."
Packit 0a8e54
      touch .amend
Packit 0a8e54
    fi ;;
Packit 0a8e54
  *) ;;
Packit 0a8e54
esac