Re: [PATCH v4 01/19] scripts/clean-includes: Fully skip / ignore files
"Michael S. Tsirkin" writes: > On Thu, Jan 19, 2023 at 07:59:41AM +0100, Markus Armbruster wrote: >> When clean-includes claims to skip or ignore a file, only the part >> that sanitizes use of qemu/osdep.h skips the file. The part that >> looks for duplicate #include does not, and neither does committing to >> Git. >> >> The latter can get unrelated stuff included in the commit, but only if >> you run clean-includes in a dirty tree, which is unwise. Messed up >> when we added skipping in commit fd3e39a40c "scripts/clean-includes: >> Enhance to handle header files". >> >> The former can cause bogus reports for --check-dup-head. Added in >> commit d66253e46a "scripts/clean-includes: added duplicate #include >> check", duplicating the prior mistake. >> >> Fix the script to fully skip files. >> >> Fixes: fd3e39a40ca2ee26b09a5de3149af8b056b85233 >> Fixes: d66253e46ae2b9c36a9dd90b2b74c0dfa5804b22 > > Isn't > Fixes: %h (\"%s\") > > the accepted format for this? It seems to be common these days. I'll adjust.
Re: [PATCH v4 01/19] scripts/clean-includes: Fully skip / ignore files
On Thu, Jan 19, 2023 at 07:59:41AM +0100, Markus Armbruster wrote: > When clean-includes claims to skip or ignore a file, only the part > that sanitizes use of qemu/osdep.h skips the file. The part that > looks for duplicate #include does not, and neither does committing to > Git. > > The latter can get unrelated stuff included in the commit, but only if > you run clean-includes in a dirty tree, which is unwise. Messed up > when we added skipping in commit fd3e39a40c "scripts/clean-includes: > Enhance to handle header files". > > The former can cause bogus reports for --check-dup-head. Added in > commit d66253e46a "scripts/clean-includes: added duplicate #include > check", duplicating the prior mistake. > > Fix the script to fully skip files. > > Fixes: fd3e39a40ca2ee26b09a5de3149af8b056b85233 > Fixes: d66253e46ae2b9c36a9dd90b2b74c0dfa5804b22 Isn't Fixes: %h (\"%s\") the accepted format for this? > Signed-off-by: Markus Armbruster > --- > scripts/clean-includes | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/scripts/clean-includes b/scripts/clean-includes > index d37bd4f692..86944f27fc 100755 > --- a/scripts/clean-includes > +++ b/scripts/clean-includes > @@ -111,6 +111,7 @@ cat >"$COCCIFILE" < ) > EOT > > +files= > for f in "$@"; do >case "$f" in > *.c.inc) > @@ -144,6 +145,7 @@ for f in "$@"; do >continue >;; >esac > + files="$files $f" > >if [ "$MODE" = "c" ]; then > # First, use Coccinelle to add qemu/osdep.h before the first existing > include > @@ -174,8 +176,8 @@ for f in "$@"; do > > done > > -if [ "$DUPHEAD" = "yes" ]; then > -egrep "^[[:space:]]*#[[:space:]]*include" "$@" | tr -d '[:blank:]' \ > +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 > echo "Found duplicate header file includes. Please check the above > files manually." > @@ -184,7 +186,7 @@ if [ "$DUPHEAD" = "yes" ]; then > fi > > if [ "$GIT" = "yes" ]; then > -git add -- "$@" > +git add -- $files > git commit --signoff -F - < $GITSUBJ: Clean up includes > > -- > 2.39.0
Re: [PATCH v4 01/19] scripts/clean-includes: Fully skip / ignore files
On Thu, Jan 19, 2023 at 07:59:41AM +0100, Markus Armbruster wrote: ... > > Fix the script to fully skip files. > > Fixes: fd3e39a40ca2ee26b09a5de3149af8b056b85233 > Fixes: d66253e46ae2b9c36a9dd90b2b74c0dfa5804b22 > Signed-off-by: Markus Armbruster > --- > scripts/clean-includes | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/scripts/clean-includes b/scripts/clean-includes > index d37bd4f692..86944f27fc 100755 > --- a/scripts/clean-includes > +++ b/scripts/clean-includes > @@ -111,6 +111,7 @@ cat >"$COCCIFILE" < ) > EOT > > +files= > for f in "$@"; do >case "$f" in > *.c.inc) > @@ -144,6 +145,7 @@ for f in "$@"; do >continue >;; >esac > + files="$files $f" Bash's += might perform faster here, but this is a #!/bin/sh script. Reviewed-by: Eric Blake -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[PATCH v4 01/19] scripts/clean-includes: Fully skip / ignore files
When clean-includes claims to skip or ignore a file, only the part that sanitizes use of qemu/osdep.h skips the file. The part that looks for duplicate #include does not, and neither does committing to Git. The latter can get unrelated stuff included in the commit, but only if you run clean-includes in a dirty tree, which is unwise. Messed up when we added skipping in commit fd3e39a40c "scripts/clean-includes: Enhance to handle header files". The former can cause bogus reports for --check-dup-head. Added in commit d66253e46a "scripts/clean-includes: added duplicate #include check", duplicating the prior mistake. Fix the script to fully skip files. Fixes: fd3e39a40ca2ee26b09a5de3149af8b056b85233 Fixes: d66253e46ae2b9c36a9dd90b2b74c0dfa5804b22 Signed-off-by: Markus Armbruster --- scripts/clean-includes | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/clean-includes b/scripts/clean-includes index d37bd4f692..86944f27fc 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -111,6 +111,7 @@ cat >"$COCCIFILE" < 1) print $0}' if [ $? -eq 0 ]; then echo "Found duplicate header file includes. Please check the above files manually." @@ -184,7 +186,7 @@ if [ "$DUPHEAD" = "yes" ]; then fi if [ "$GIT" = "yes" ]; then -git add -- "$@" +git add -- $files git commit --signoff -F - <