Skip to content

Commit 96c80ff

Browse files
committed
Remove openopt, allow spaces in $BROWSER
Remove the openopt variable, instead opting to allow spaces in `$BROWSER`. `$BROWSER` as used by the XDG implementation allows spaces (and `%s` printf-style formatting strings), and is actually a PATH-style list. While this patch doesn't make git-open compliant with the XDG-style variable, it does allow for the use of `BROWSER="powershell.exe Start"` in the environment.
1 parent 4ca1990 commit 96c80ff

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

git-open

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,21 +235,16 @@ case $( uname -s ) in
235235
CYGWIN*) open='cygstart';;
236236
*) # Try to detect WSL (Windows Subsystem for Linux)
237237
if uname -r | grep -q Microsoft; then
238-
open='powershell.exe'
239-
openopt='Start'
238+
open='powershell.exe Start'
240239
else
241240
open='xdg-open'
242241
fi;;
243242
esac
244243

245244
# Allow printing the url if BROWSER=echo
246-
if [[ $BROWSER == "echo" ]]; then
247-
openopt=''
248-
else
245+
if [[ $BROWSER != "echo" ]]; then
249246
exec &>/dev/null
250247
fi
251248

252249
# open it in a browser
253-
${BROWSER:-$open} $openopt "$openurl"
254-
255-
unset openopt
250+
${BROWSER:-$open} "$openurl"

0 commit comments

Comments
 (0)