[coreboot-gerrit] Change in coreboot[master]: util/gitconfig: Support dash in pre-commit hook
Alex Thiessen (Code Review)
gerrit at coreboot.org
Wed Jan 3 09:40:24 CET 2018
Alex Thiessen has uploaded this change for review. ( https://review.coreboot.org/23070
Change subject: util/gitconfig: Support dash in pre-commit hook
......................................................................
util/gitconfig: Support dash in pre-commit hook
On debian systems, /bin/sh is `dash` which has built-in `echo` always
interpreting escape sequences such as '\n'. The pre-commit hook uses
the built-in for piping diff to checkpatch, interpreting the diff's
escape sequences in the process and leading to false negatives
and preventing commits despite conformance.
Use `printf` instead of `echo` when handling diff content. The bug was
introduced in commit ef869305.
Change-Id: I37edfe7b32721cb63d99299563cb11f26082c9a9
Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot at gmail.com>
---
M util/gitconfig/pre-commit
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/23070/1
diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit
index 257f696..1c04bc3 100755
--- a/util/gitconfig/pre-commit
+++ b/util/gitconfig/pre-commit
@@ -2,8 +2,8 @@
%MAKE% lint-stable
PATCHDIFF=$(git diff --cached)
-if echo "$PATCHDIFF" | grep -q "@@"; then
+if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then
echo
echo "Running checkpatch"
- echo "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q -
+ printf "%s\n" "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q -
fi
--
To view, visit https://review.coreboot.org/23070
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37edfe7b32721cb63d99299563cb11f26082c9a9
Gerrit-Change-Number: 23070
Gerrit-PatchSet: 1
Gerrit-Owner: Alex Thiessen <alex.thiessen.de+coreboot at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180103/0f959bf5/attachment-0001.html>
More information about the coreboot-gerrit
mailing list