+ if [ "$(git config gcc-config.mklog-hook-type)" = "smart-amend" ]; then
+ # Check if the existing message still describes the staged changes.
+ f=$(mktemp /tmp/git-commit.XXXXXX) || exit 1
+ git log -1 --pretty=email HEAD > $f
+ printf '\n---\n\n' >> $f
+ git $cmd >> $f
+ if contrib/gcc-changelog/git_email.py "$f" >/dev/null 2>&1; then
+ # Existing commit message is still OK for amended commit.
+ rm $f
+ exit 0
+ fi
+ rm $f
+ fi