aboutsummaryrefslogtreecommitdiff
path: root/scripts/clean-includes
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-02-02 14:38:12 +0100
committerMarkus Armbruster <armbru@redhat.com>2023-02-08 07:16:23 +0100
commit2555150244393a8cf433d6762c265b1e89c70be4 (patch)
tree39f4ec24b7d6ce3d44eaa84ab31dfbb4aca703bd /scripts/clean-includes
parentaa735872a879075d1e9d669c8d5737f41232a3e3 (diff)
scripts/clean-includes: Don't claim duplicate headers found when not
When running with --check-dup-head, the script always claims it "Found duplicate header file includes." Fix to do it only when it actually found some. Fixes: d66253e46ae2 ("scripts/clean-includes: added duplicate #include check") Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20230202133830.2152150-3-armbru@redhat.com>
Diffstat (limited to 'scripts/clean-includes')
-rwxr-xr-xscripts/clean-includes5
1 files changed, 2 insertions, 3 deletions
diff --git a/scripts/clean-includes b/scripts/clean-includes
index 86944f27fc..8e8420d785 100755
--- a/scripts/clean-includes
+++ b/scripts/clean-includes
@@ -177,9 +177,8 @@ for f in "$@"; do
done
if [ "$DUPHEAD" = "yes" ] && [ -n "$files" ]; then
- egrep "^[[:space:]]*#[[:space:]]*include" $files | tr -d '[:blank:]' \
- | sort | uniq -c | awk '{if ($1 > 1) print $0}'
- if [ $? -eq 0 ]; then
+ if egrep "^[[:space:]]*#[[:space:]]*include" $files | tr -d '[:blank:]' \
+ | sort | uniq -c | grep -v '^ *1 '; then
echo "Found duplicate header file includes. Please check the above files manually."
exit 1
fi