Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork937
feat(cmd): add thestrip_newline
flag#1423
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This commit adds the `strip_newline` flag to the `Git.execute` method.When this flag is set to `True`, it will trim the trailing `\n`. Thedefault value is `True` for backward compatibility. Setting it to`False` is helpful for, e.g., the `git show` output, especially with the binaryfile, as the missing `\n` may invalidate the file.
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 a lot for the fix!
Regarding stdout/stderr:strip_newline
might imply a newline is stripped universally, even though it applies tostdout
only at the moment.
Maybe it should be calledstrip_newline_in_stdout
to be specific while allowing to add a similar flag forstderr
when there is a need?
PS: CI had issues but after restarting it the error now seems 'legit' (as it is upset about whitespace :/)
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.
Thank you, looks great to me!
Uh oh!
There was an error while loading.Please reload this page.
This PR adds the
strip_newline
flag to theGit.execute
method. When this flag is set toTrue
, it will trim the trailing\n
. The default value isTrue
for backward compatibility. Setting it toFalse
is helpful for, e.g., thegit show
output, especially with the binary file, as the missing\n
may invalidate the file.Looking at the first some bytes and checking if the output is binary or not is another option to prevent making an invalid binary file. Still, I chose to add a parameter because it is easy to implement, is fully backward compatible, and doesn't add many lines to the source code.
Fixes:#1377
By the way, do we need to handle stderr too?