xref: /aosp_15_r20/external/coreboot/util/gitconfig/pre-commit (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1#!/usr/bin/env sh
2##
3## SPDX-License-Identifier: GPL-2.0-only
4
5set -e # -o errexit
6set -u # -o nounset
7
8%MAKE% check-style lint-stable
9
10PATCHDIFF=$(git diff --cached --src-prefix=a/ --dst-prefix=b/)
11if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then
12	echo
13	echo "Running checkpatch"
14	printf "%s\n" "$PATCHDIFF" | util/lint/lint-007-checkpatch diff \
15		|| (echo "Please consider fixing these issues." ;sleep 5) ; true
16fi
17