Fix UnicodeDecodeError in git_check_deviation (#26439)

Fix UnicodeDecodeError in git_check_deviation

Decode git log output to bytes to prevent Unicode errors.
This commit is contained in:
Joel Challis
2026-09-04 09:50:06 +08:00
committed by GitHub
parent 3c73e928ab
commit f07f83fd45
+2 -1
View File
@@ -134,7 +134,8 @@ def git_check_deviation(active_branch):
"""Return True if branch has custom commits """Return True if branch has custom commits
""" """
cli.run(['git', 'fetch', 'upstream', active_branch]) 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) return bool(deviations.returncode)