blob: 60ec3e4be6d19e461ab7af22fcb5dde0c7bfb5f3 [file] [log] [blame]
Pete Batardb9e3a9b2012-04-11 23:12:21 +01001#!/bin/sh
2#
3# Detect amended commits and warn user if .amend is missing
4#
5# To have git run this script on commit, create a "post-rewrite" text file in
6# .git/hooks/ with the following content:
7# #!/bin/sh
8# if [ -x .private/post-rewrite.sh ]; then
9# source .private/post-rewrite.sh
10# fi
11#
12# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the
hjelmn@cs.unm.edu1eff2202014-01-08 23:50:34 +000013# libusb development team and are NOT intended to solve versioning for any
Pete Batardb9e3a9b2012-04-11 23:12:21 +010014# derivative branch, such as one you would create for private development.
15#
16
Chris Dickens9fd76592020-04-16 17:10:39 -070017if [ -n "$LIBUSB_SKIP_NANO" ]; then
18 exit 0
19fi
20
Pete Batardb9e3a9b2012-04-11 23:12:21 +010021case "$1" in
22 amend)
23 # Check if a .amend exists. If none, create one and warn user to re-commit.
24 if [ -f .amend ]; then
25 rm .amend
26 else
27 echo "Amend commit detected, but no .amend file - One has now been created."
28 echo "Please re-commit as is (amend), so that the version number is correct."
29 touch .amend
30 fi ;;
31 *) ;;
32esac