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