Skip to content
Snippets Groups Projects
Commit 16b7f0a1 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

Block files without trailing newlines

Add a pre-submit check to ensure that files have a newline character at
the end.

Please see https://android.googlesource.com/platform/tools/repohooks/
for documentation on how PREUPLOAD hooks work.

Test: created a change and watched the presubmit check reject it.
Change-Id: Id0528cb1bd6fa9c4483ba43720839832f4fec34d
parent cb4f5b3c
Branches
Tags
No related merge requests found
[Hook Scripts]
whitespace = tools/whitespace.sh ${PREUPLOAD_FILES}
#!/bin/bash
RESULT=0
for i in "$@"; do
a="`tail -c 1 "$i"`"
if [ "$a" != "" ]; then
echo "$i does not have a trailing newline" 1>&2
RESULT=-1
fi
done
exit $RESULT
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment