diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-08-20 16:26:19 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-08-21 10:33:27 +0000 |
commit | ded9502576543d83ba157eca42515ccd656b25fb (patch) | |
tree | e6ec7cdc2b5890178b530b879ec0ee6f8f96c041 /git-hooks/sanitize-commit | |
parent | 8d06cfdf6e2c3932ec631a44cd6e1bf8091095a3 (diff) | |
download | qtrepotools-ded9502576543d83ba157eca42515ccd656b25fb.tar.gz |
sanitizer: slightly refactor initialization of $eof_check
... so it's more consistent with the other flags.
Change-Id: Ic2eae23ed10594f7adab7f5980852294252923d9
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'git-hooks/sanitize-commit')
-rwxr-xr-x | git-hooks/sanitize-commit | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git-hooks/sanitize-commit b/git-hooks/sanitize-commit index d8cf21a..d7396af 100755 --- a/git-hooks/sanitize-commit +++ b/git-hooks/sanitize-commit @@ -764,10 +764,8 @@ while (<DIFF>) { $in_plus = 0; next; } - if ($eof_check && !$is_special && /^\\ No newline/) { - if ($in_plus) { - complain("No newline at end of file", "fileend") if (!defined($cfg{fileend})); - } + if ($eof_check && !$is_special && $in_plus && /^\\ No newline/) { + complain("No newline at end of file", "fileend"); next; } if ($merge ? /^\@\@\@ -\S+ -\S+ \+(\d+)/ : /^\@\@ -\S+ \+(\d+)/) { @@ -803,7 +801,8 @@ while (<DIFF>) { && ($file !~ /((^|\/)Makefile\b|debian[.\/]rules|\.(pbxproj|plist(\.[^.\/]+)?|def|mk|spec|changes|[xn]ib|storyboardc?|go|svg|ui[ap])(?:\.in)?$)/); $allow_2spaces = $ws_check && ($file =~ /\.md$/); $ctlkw_check = $tabs_check && $clike; - $eof_check = !$foreign && ($file !~ /(\.plist(\.[^.\/]+)?|\.xcassets\/.*\.json)$/); # Xcode consistently forgets the trailing newline + $eof_check = !defined($cfg{fileend}) && !$foreign + && ($file !~ /(\.plist(\.[^.\/]+)?|\.xcassets\/.*\.json)$/); # Xcode consistently forgets the trailing newline # .ts files usually contain languages other than English $spell_check = !defined($cfg{spell}) && !$foreign && ($file !~ /\.ts$/i); $apple_check = !$foreign && ($file !~ /\.ts$/i); |