andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.18k stars 59 forks source link

Improved shell_escape used for both interactive and non-interactive shell #74

Closed carlolars closed 5 years ago

carlolars commented 5 years ago

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 commented 5 years ago

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