[libcamera-devel] [PATCH] utils: checkstyle.py: Don't run commit title checker on staged commits

Paul Elder paul.elder at ideasonboard.com
Mon Feb 27 13:15:46 CET 2023


When creating a new commit, there is no title, so the title checker
complains that the title isn't compliant and the commit cannot be
created if checkstyle is run as a pre-commit hook. Fix this by skipping
the title checker when run on staged changes.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
---
 utils/checkstyle.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/utils/checkstyle.py b/utils/checkstyle.py
index 78645410..84f0f50f 100755
--- a/utils/checkstyle.py
+++ b/utils/checkstyle.py
@@ -360,6 +360,9 @@ class TitleChecker(CommitChecker):
     def check(cls, commit, top_level):
         title = commit.title
 
+        if title == 'Staged changes':
+            return []
+
         # Ignore release commits, they don't need a prefix.
         if TitleChecker.release_regex.fullmatch(title):
             return []
-- 
2.35.1



More information about the libcamera-devel mailing list