Skip to content

Commit

Permalink
Merge pull request #444 from akaihola/fix-git-error-output
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola authored Jan 5, 2023
2 parents 5a1e290 + a08ac8c commit b8c02b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Fixed
- Compatibility of highlighting unit tests with Pygments 2.14.0.
- In the CI test workflow, don't use environment variables to add a Black version
constraint to the ``pip`` command. This fixes the Windows builds.
- Pass Git errors to stderr correctly both in raw and encoded subprocess output mode.


1.6.1_ - 2022-12-28
Expand Down
5 changes: 4 additions & 1 deletion src/darker/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,10 @@ def _git_check_output(
if not exit_on_error:
raise
if exc_info.returncode != 128:
sys.stderr.write(exc_info.stderr)
if encoding:
sys.stderr.write(exc_info.stderr)
else:
sys.stderr.buffer.write(exc_info.stderr)
raise

# Bad revision or another Git failure. Follow Black's example and return the
Expand Down

0 comments on commit b8c02b7

Please sign in to comment.