Skip to content

Conversation

carlolars
Copy link
Contributor

Changed the shell_escape function to always escape newline and quote arguments in single-quote if they contain invalid characters (' ', (, ), and |), but only if the argument is not a long argument (starts with --).
shell_escape is called for both interactive and non-interactive shell.

This fixes #73 and #54 and #46 still works, verified with

wslgit.exe config --get-regex "user.(name|email)"
wslgit.exe log --name-status --format="%x3c%x2ff%x3e%n%x3cr%x3e %H%n%x3ca%x3e %an%n%x3ce%x3e %ae%n%x3cd%x3e %at%n%x3cp%x3e %P%n%x3cs%x3e%n%B%n%x3c%x2fs%x3e%n%x3cf%x3e" -n200

@andy-5
Copy link
Owner

andy-5 commented Jun 11, 2019

Your changes look good, I'll merge them shortly. Thank you for fixing this.

@andy-5 andy-5 merged commit 0cd4f0b into andy-5:master Jun 11, 2019
@carlolars carlolars deleted the shell_escape_for_non-interactive branch June 11, 2019 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Newline not escaped for non-interactive shell
2 participants