]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scripts/clean-includes: Give the args in git commit messages
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 16 Jan 2026 12:40:04 +0000 (12:40 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 22 Jan 2026 11:23:31 +0000 (11:23 +0000)
If clean-includes is creating a git commit for its changes,
currently it says only "created with scripts/clean-includes".
Add the command line arguments the user passed us, as useful
extra information.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 20260116124005.925382-6-peter.maydell@linaro.org

scripts/clean-includes

index a45421d2ff73c1ca8542a48797a3f5e91b2a1edb..064e532037b701045b4a6108114058d5471c15e0 100755 (executable)
 GIT=no
 DUPHEAD=no
 
+# Save the original arguments in case we want to put them in
+# a git commit message, quoted for the shell so that we handle
+# args with spaces/metacharacters correctly.
+# The quote_sh() function is the same one we use in configure.
+
+quote_sh() {
+    printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
+}
+
+quote_args() {
+    while [ $# -gt 0 ]; do
+        printf "%s" "$(quote_sh "$1")"
+        shift
+        if [ $# -gt 0 ]; then
+            printf " "
+        fi
+    done
+}
+
+QUOTEDARGS="$(quote_args "$@")"
 
 while true
 do
@@ -198,7 +218,8 @@ if [ "$GIT" = "yes" ]; then
     git commit --signoff -F - <<EOF
 $GITSUBJ: Clean up includes
 
-This commit was created with scripts/clean-includes.
+This commit was created with scripts/clean-includes:
+ ./scripts/clean-includes $QUOTEDARGS
 
 All .c should include qemu/osdep.h first.  The script performs three
 related cleanups: