]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
clang-format: don't reformat schema on rewrite-branch
authorJason Ish <jason.ish@oisf.net>
Fri, 23 May 2025 15:42:18 +0000 (09:42 -0600)
committerVictor Julien <victor@inliniac.net>
Tue, 27 May 2025 19:43:51 +0000 (21:43 +0200)
Add --extensions c,h flag to git clang-format when reformatting
commits on a branch. This prevents clang-format from modifying
non-C files like JSON schemas.

The extensions is used elsewhere in this script, so I suspect it was
just an oversight.

Also, ./scripts/schema-order.py --in-place will consistently format the
schema, while sorting the keys.

scripts/clang-format.sh

index fb2f53ab8e52994855fc059793416f44b7b67c54..7563bad15921b38b59fc156a9780219890b40fcd 100755 (executable)
@@ -544,7 +544,7 @@ function ReformatCommitsOnBranch {
         local first_commit=$(FirstCommitOfBranch)
         echo "First commit on branch: $first_commit"
         # Use --force in case it's run a second time on the same branch
-        git filter-branch --force --tree-filter "$GIT_CLANG_FORMAT $first_commit^" -- $first_commit..HEAD
+        git filter-branch --force --tree-filter "$GIT_CLANG_FORMAT --extensions c,h $first_commit^" -- $first_commit..HEAD
         if [ $? -ne 0 ]; then
             Die "Cannot rewrite branch. git filter-branch failed"
         fi