#!/bin/sh # # Called by "git commit" with one argument, the name of the file # that has the commit message. The hook should exit with non-zero # status after issuing an appropriate message if it wants to stop the # commit. The hook is allowed to edit the commit message file. # Process all Fixes tags, check commit IDs and set appropriate commit titles. for COMMIT in $(sed -n -e 's/^Fixes: \([0-9a-z]*\).*/\1/p' "$1"); do GOOD=$(git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n" $COMMIT -- 2>/dev/null) if [ -z "$GOOD" ]; then echo "Unknown commit: $COMMIT" exit 1 fi echo "Setting fixes tag: $GOOD" sed -i -e "s/^Fixes: $COMMIT.*/Fixes: $GOOD/" "$1" done exit 0