-
-
Notifications
You must be signed in to change notification settings - Fork 914
Pass color option to git diff (on failure) #1051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@asottile Build is failing on Windows, getting error : Can you help ? |
asottile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to ignore the windows failures, azure pipelines added their own rust in a different place so it isn't picking it up -- I'll put in a fix for that
|
alright I've fixed the |
pre_commit/commands/run.py
Outdated
| '--color={}'.format(args.color), | ||
| )) | ||
| else: | ||
| subprocess.call(('git', '--no-pager', 'diff', '--no-ext-diff')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think basically what we're going to have to end up with is:
cmd = ('git', '--no-pager', 'diff', '--no-ext-diff')
if args.color:
cmd += ('--color=always',)
subprocess.call(cmd)Since at this point args.color will always be a boolean
tests/commands/run_test.py
Outdated
| ( | ||
| { | ||
| 'show_diff_on_failure': True, | ||
| 'color': 'auto', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so as above, this isn't a valid option here unfortunately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the tests pass :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeahhhh the tests pass because we ignore the return code of git diff -- it actually ends up printing something like this:
$ git diff --color=True
error: option `color' expects "always", "auto", or "never"|
ah shoot sorry, I wasn't fast enough -- you were right /o\ |
|
@asottile Now the build is failing on
I don't have "write" access, so someone with write access will have to "ignore the error" and accept/merge the commit. |
|
I'm streaming right now if you want to chat about this PR -- https://twitch.tv/anthonywritescode :) |
|
the CI flakes are due to this I believe: coveragepy/coveragepy#807 hopefully I'll be able to fix them at some point :S |
|
@asottile Hopefully this is the last iteration. Please review and accept/merge the PR. |
asottile
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Thanks! |

Fixes #1007