blob: ab4b5e7196af428ded6923a226ce751477adb49d [file] [log] [blame]
#!/bin/sh
# Copyright (C) 2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
scriptdir=$(cd "$(dirname "$0")" || exit 1; pwd -P)
tmp=""
cleanup()
{
if [ "$tmp" != "" ]; then
rm -f "$tmp"
fi
}
# Schedule cleanup.
trap cleanup EXIT
# Get temporary file.
tmp=$(mktemp)
# Generate patch.
git diff --staged "$@" \
> "$tmp"
# Verify patch. Ignore exit status.
"$scriptdir"/../../contrib/check_GNU_style.py "$tmp" \
|| true