Alex Thiessen has uploaded this change for review. ( https://review.coreboot.org/23096
Change subject: util/gitconfig: Use `make` in git hooks ......................................................................
util/gitconfig: Use `make` in git hooks
As the code was moved from the Makefile.inc to a separate file in commit 9ab8ae6a (util/gitconfig: Make gitconfig a bash script), `$(MAKE)` was replaced by `remake`, introducing dependency on this tool which is basically a `make` with debugging capabilities. Many developers don't have `remake` installed, leading to pre-commit hooks being not executed properly. Apparently this was an unintentional change.
Furthermore, special treatment of `make` tool via the `%MAKE%` substitution performed during hooks' deployment doesn't seem justified. It was introduced in commit f3947152 (gitconfig: Use the right make executable in git hooks) and back then, `make` was called via `exec`. This is not the case anymore since commit b18f522b (lint/gitconfig: Enable checkpatch.pl checking of commits) and I think it's obsolete now.
Replace `sed` and `chmod +x` with `install` for brevity.
Change-Id: Ia78e06567b904b342dc9b7778569201fe02e6897 Signed-off-by: Alex Thiessen alex.thiessen.de+coreboot@gmail.com --- M util/gitconfig/gitconfig.sh M util/gitconfig/pre-commit 2 files changed, 3 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/96/23096/1
diff --git a/util/gitconfig/gitconfig.sh b/util/gitconfig/gitconfig.sh index 5f91a69..e6da0ee 100755 --- a/util/gitconfig/gitconfig.sh +++ b/util/gitconfig/gitconfig.sh @@ -7,8 +7,7 @@ for hook in commit-msg pre-commit ; do if [ util/gitconfig/$hook -nt .git/hooks/$hook ] || \ [ ! -x .git/hooks/$hook ]; then - sed -e "s,%MAKE%,remake,g" util/gitconfig/$hook > .git/hooks/$hook - chmod +x .git/hooks/$hook + install "util/gitconfig/${hook}" ".git/hooks" fi done # Now set up the hooks for 3rdparty/ @@ -16,9 +15,7 @@ if [ -d $hooks ]; then if [ util/gitconfig/commit-msg -nt $hooks/commit-msg ] || \ [ ! -x $hooks/commit-msg ]; then - sed -e "s,%MAKE%,remake,g" \ - util/gitconfig/commit-msg > $hooks/commit-msg - chmod +x $hooks/commit-msg + install "util/gitconfig/commit-msg" "${hooks}" fi fi done diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit index 1c04bc3..2c1a2aa 100755 --- a/util/gitconfig/pre-commit +++ b/util/gitconfig/pre-commit @@ -1,5 +1,5 @@ #!/bin/sh -%MAKE% lint-stable +make lint-stable
PATCHDIFF=$(git diff --cached) if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then