<p>Alex Thiessen has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/23070">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">util/gitconfig: Support dash in pre-commit hook<br><br>On debian systems, /bin/sh is `dash` which has built-in `echo` always<br>interpreting escape sequences such as '\n'. The pre-commit hook uses<br>the built-in for piping diff to checkpatch, interpreting the diff's<br>escape sequences in the process and leading to false negatives<br>and preventing commits despite conformance.<br><br>Use `printf` instead of `echo` when handling diff content. The bug was<br>introduced in commit ef869305.<br><br>Change-Id: I37edfe7b32721cb63d99299563cb11f26082c9a9<br>Signed-off-by: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com><br>---<br>M util/gitconfig/pre-commit<br>1 file changed, 2 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/23070/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/util/gitconfig/pre-commit b/util/gitconfig/pre-commit</span><br><span>index 257f696..1c04bc3 100755</span><br><span>--- a/util/gitconfig/pre-commit</span><br><span>+++ b/util/gitconfig/pre-commit</span><br><span>@@ -2,8 +2,8 @@</span><br><span> %MAKE% lint-stable</span><br><span> </span><br><span> PATCHDIFF=$(git diff --cached)</span><br><span style="color: hsl(0, 100%, 40%);">-if echo "$PATCHDIFF" | grep -q "@@"; then</span><br><span style="color: hsl(120, 100%, 40%);">+if printf "%s\n" "$PATCHDIFF" | grep -q "@@"; then</span><br><span>      echo</span><br><span>         echo "Running checkpatch"</span><br><span style="color: hsl(0, 100%, 40%);">-     echo "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q -</span><br><span style="color: hsl(120, 100%, 40%);">+       printf "%s\n" "$PATCHDIFF" | util/lint/checkpatch.pl --no-signoff -q -</span><br><span> fi</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/23070">change 23070</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/23070"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I37edfe7b32721cb63d99299563cb11f26082c9a9 </div>
<div style="display:none"> Gerrit-Change-Number: 23070 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Alex Thiessen <alex.thiessen.de+coreboot@gmail.com> </div>