cache.h: move remote/connect API out of it
[gitweb.git] / git-web--browse.sh
index e9de241dd004a9f5d6d6d8e6a300a1fa5949a46d..1d72ec760e9d69e0fc29a699fa60be945f872a93 100755 (executable)
@@ -32,8 +32,9 @@ valid_custom_tool()
 valid_tool() {
        case "$1" in
        firefox | iceweasel | seamonkey | iceape | \
-       chrome | google-chrome | chromium | chromium-browser |\
-       konqueror | opera | w3m | elinks | links | lynx | dillo | open | start)
+       chrome | google-chrome | chromium | chromium-browser | \
+       konqueror | opera | w3m | elinks | links | lynx | dillo | open | \
+       start | cygstart)
                ;; # happy
        *)
                valid_custom_tool "$1" || return 1
@@ -119,14 +120,18 @@ if test -z "$browser" ; then
                browser_candidates="w3m elinks links lynx"
        fi
        # SECURITYSESSIONID indicates an OS X GUI login session
-       if test -n "$SECURITYSESSIONID" \
-               -o "$TERM_PROGRAM" = "Apple_Terminal" ; then
+       if test -n "$SECURITYSESSIONID" || test -n "$TERM_PROGRAM"
+       then
                browser_candidates="open $browser_candidates"
        fi
        # /bin/start indicates MinGW
        if test -x /bin/start; then
                browser_candidates="start $browser_candidates"
        fi
+       # /usr/bin/cygstart indicates Cygwin
+       if test -x /usr/bin/cygstart; then
+               browser_candidates="cygstart $browser_candidates"
+       fi
 
        for i in $browser_candidates; do
                init_browser_path $i
@@ -156,7 +161,7 @@ firefox|iceweasel|seamonkey|iceape)
        ;;
 google-chrome|chrome|chromium|chromium-browser)
        # No need to specify newTab. It's default in chromium
-       eval "$browser_path" "$@" &
+       "$browser_path" "$@" &
        ;;
 konqueror)
        case "$(basename "$browser_path")" in
@@ -164,18 +169,18 @@ konqueror)
                # It's simpler to use kfmclient to open a new tab in konqueror.
                browser_path="$(echo "$browser_path" | sed -e 's/konqueror$/kfmclient/')"
                type "$browser_path" > /dev/null 2>&1 || die "No '$browser_path' found."
-               eval "$browser_path" newTab "$@"
+               "$browser_path" newTab "$@" &
                ;;
        kfmclient)
-               eval "$browser_path" newTab "$@"
+               "$browser_path" newTab "$@" &
                ;;
        *)
                "$browser_path" "$@" &
                ;;
        esac
        ;;
-w3m|elinks|links|lynx|open)
-       eval "$browser_path" "$@"
+w3m|elinks|links|lynx|open|cygstart)
+       "$browser_path" "$@"
        ;;
 start)
        exec "$browser_path" '"web-browse"' "$@"
@@ -185,7 +190,7 @@ opera|dillo)
        ;;
 *)
        if test -n "$browser_cmd"; then
-               ( eval $browser_cmd "$@" )
+               ( eval "$browser_cmd \"\$@\"" )
        fi
        ;;
 esac