Browse Source

Fix UnicodeDecodeError in `git_check_deviation` (#26439)

Fix UnicodeDecodeError in git_check_deviation

Decode git log output to bytes to prevent Unicode errors.
Joel Challis 1 week ago
parent
commit
f07f83fd45
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/python/qmk/git.py

+ 2 - 1
lib/python/qmk/git.py

@@ -134,7 +134,8 @@ def git_check_deviation(active_branch):
     """Return True if branch has custom commits
     """
     cli.run(['git', 'fetch', 'upstream', active_branch])
-    deviations = cli.run(['git', '--no-pager', 'log', f'upstream/{active_branch}...{active_branch}'])
+    # As we only care about exit code, decode to bytes to avoid UnicodeDecodeError
+    deviations = cli.run(['git', '--no-pager', 'log', f'upstream/{active_branch}...{active_branch}'], text=False)
     return bool(deviations.returncode)