X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=git-web--browse.sh;h=78d236b77f6e2b52d89bf7b579762723ede86d15;hb=6e13921b4f7adcc7316a76c0c4955b85b1589a65;hp=1023b9085989aecfdcdc161232ee22de866d5f57;hpb=ad416ed433fdcf838916a84177fe9e810be19eff;p=git.git diff --git a/git-web--browse.sh b/git-web--browse.sh index 1023b9085..78d236b77 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -23,12 +23,18 @@ USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...' NONGIT_OK=Yes . git-sh-setup +valid_custom_tool() +{ + browser_cmd="$(git config "browser.$1.cmd")" + test -n "$browser_cmd" +} + valid_tool() { case "$1" in - firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open) + firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start) ;; # happy *) - return 1 + valid_custom_tool "$1" || return 1 ;; esac } @@ -108,6 +114,10 @@ if test -z "$browser" ; then if test -n "$SECURITYSESSIONID"; then browser_candidates="open $browser_candidates" fi + # /bin/start indicates MinGW + if test -n /bin/start; then + browser_candidates="start $browser_candidates" + fi for i in $browser_candidates; do init_browser_path $i @@ -122,7 +132,7 @@ else init_browser_path "$browser" - if ! type "$browser_path" > /dev/null 2>&1; then + if test -z "$browser_cmd" && ! type "$browser_path" > /dev/null 2>&1; then die "The browser $browser is not available as '$browser_path'." fi fi @@ -151,10 +161,15 @@ case "$browser" in ;; esac ;; - w3m|links|lynx|open) + w3m|links|lynx|open|start) eval "$browser_path" "$@" ;; dillo) "$browser_path" "$@" & ;; + *) + if test -n "$browser_cmd"; then + ( eval $browser_cmd "$@" ) + fi + ;; esac