git-daemon: produce output when ready
[gitweb.git] / git-web--browse.sh
index c108eefb4810e1167f28a563b02895266da3098f..1e827264b4cab04a801804b8d066f9d2cbb85edc 100755 (executable)
@@ -31,7 +31,8 @@ valid_custom_tool()
 
 valid_tool() {
        case "$1" in
-       firefox | iceweasel | seamonkey | iceape | chrome | google-chrome | chromium | \
+       firefox | iceweasel | seamonkey | iceape | \
+       chrome | google-chrome | chromium | chromium-browser |\
        konqueror | opera | w3m | elinks | links | lynx | dillo | open | start)
                ;; # happy
        *)
@@ -42,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
@@ -104,7 +111,7 @@ fi
 
 if test -z "$browser" ; then
        if test -n "$DISPLAY"; then
-               browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror opera seamonkey iceape w3m elinks 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
@@ -147,10 +154,9 @@ firefox|iceweasel|seamonkey|iceape)
        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" "$@" &
+       "$browser_path" "$@" &
        ;;
 konqueror)
        case "$(basename "$browser_path")" in
@@ -158,10 +164,10 @@ 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" "$@" &
@@ -169,7 +175,7 @@ konqueror)
        esac
        ;;
 w3m|elinks|links|lynx|open)
-       eval "$browser_path" "$@"
+       "$browser_path" "$@"
        ;;
 start)
        exec "$browser_path" '"web-browse"' "$@"
@@ -179,7 +185,7 @@ opera|dillo)
        ;;
 *)
        if test -n "$browser_cmd"; then
-               ( eval $browser_cmd "$@" )
+               ( eval "$browser_cmd \"\$@\"" )
        fi
        ;;
 esac