]> git.ipfire.org Git - thirdparty/git.git/blobdiff - git-web--browse.sh
gitweb: remove unnecessary test when closing file descriptor
[thirdparty/git.git] / git-web--browse.sh
index 7c4568fc236c1e76ff67a5ca0f55487052f844ae..e9de241dd004a9f5d6d6d8e6a300a1fa5949a46d 100755 (executable)
@@ -31,7 +31,9 @@ valid_custom_tool()
 
 valid_tool() {
        case "$1" in
-       firefox | iceweasel | chrome | google-chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start)
+       firefox | iceweasel | seamonkey | iceape | \
+       chrome | google-chrome | chromium | chromium-browser |\
+       konqueror | opera | w3m | elinks | links | lynx | dillo | open | start)
                ;; # happy
        *)
                valid_custom_tool "$1" || return 1
@@ -41,7 +43,13 @@ valid_tool() {
 
 init_browser_path() {
        browser_path=$(git config "browser.$1.path")
-       test -z "$browser_path" && browser_path="$1"
+       if test -z "$browser_path" &&
+          test "$1" = chromium &&
+          type chromium-browser >/dev/null 2>&1
+       then
+               browser_path=chromium-browser
+       fi
+       : ${browser_path:="$1"}
 }
 
 while test $# != 0
@@ -103,12 +111,12 @@ fi
 
 if test -z "$browser" ; then
        if test -n "$DISPLAY"; then
-               browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror w3m links lynx dillo"
+               browser_candidates="firefox iceweasel google-chrome chrome chromium chromium-browser konqueror opera seamonkey iceape w3m elinks links lynx dillo"
                if test "$KDE_FULL_SESSION" = "true"; then
                        browser_candidates="konqueror $browser_candidates"
                fi
        else
-               browser_candidates="w3m links lynx"
+               browser_candidates="w3m elinks links lynx"
        fi
        # SECURITYSESSIONID indicates an OS X GUI login session
        if test -n "$SECURITYSESSIONID" \
@@ -139,15 +147,14 @@ else
 fi
 
 case "$browser" in
-firefox|iceweasel)
+firefox|iceweasel|seamonkey|iceape)
        # Check version because firefox < 2.0 does not support "-new-tab".
        vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
        NEWTAB='-new-tab'
        test "$vers" -lt 2 && NEWTAB=''
        "$browser_path" $NEWTAB "$@" &
        ;;
-google-chrome|chrome|chromium)
-       # Actual command for chromium is chromium-browser.
+google-chrome|chrome|chromium|chromium-browser)
        # No need to specify newTab. It's default in chromium
        eval "$browser_path" "$@" &
        ;;
@@ -167,13 +174,13 @@ konqueror)
                ;;
        esac
        ;;
-w3m|links|lynx|open)
+w3m|elinks|links|lynx|open)
        eval "$browser_path" "$@"
        ;;
 start)
        exec "$browser_path" '"web-browse"' "$@"
        ;;
-dillo)
+opera|dillo)
        "$browser_path" "$@" &
        ;;
 *)