diff options
author | Pete Batard <pete@akeo.ie> | 2012-04-11 23:12:21 +0100 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-04-11 23:45:37 +0100 |
commit | b9e3a9b74cb78302b19652b44114f2e491dd24f2 (patch) | |
tree | ee463def302506d7361ec853f0d97b7815c533bc /.private/post-rewrite.sh | |
parent | ff19395ca935d5c1bd658e4b3e5b5a9240c074a9 (diff) | |
download | libusb-b9e3a9b74cb78302b19652b44114f2e491dd24f2.tar.gz |
Git: add pre-commit and post-rewrite hooks for versioning
* Also adds the maintainer-only .private directory
Diffstat (limited to '.private/post-rewrite.sh')
-rwxr-xr-x | .private/post-rewrite.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/.private/post-rewrite.sh b/.private/post-rewrite.sh new file mode 100755 index 0000000..b5fff07 --- /dev/null +++ b/.private/post-rewrite.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Detect amended commits and warn user if .amend is missing +# +# To have git run this script on commit, create a "post-rewrite" text file in +# .git/hooks/ with the following content: +# #!/bin/sh +# if [ -x .private/post-rewrite.sh ]; then +# source .private/post-rewrite.sh +# fi +# +# NOTE: These versioning hooks are intended to be used *INTERNALLY* by the +# libusbx development team and are NOT intended to solve versioning for any +# derivative branch, such as one you would create for private development. +# + +case "$1" in + amend) + # Check if a .amend exists. If none, create one and warn user to re-commit. + if [ -f .amend ]; then + rm .amend + else + echo "Amend commit detected, but no .amend file - One has now been created." + echo "Please re-commit as is (amend), so that the version number is correct." + touch .amend + fi ;; + *) ;; +esac |