git-p4: Unset P4DIFF environment variable when using 'p4 -du diff'
[gitweb.git] / git-web--browse.sh
index 8ed489d8827f974b9a11ca5789a9fe3df9c9866b..1023b9085989aecfdcdc161232ee22de866d5f57 100755 (executable)
@@ -25,7 +25,7 @@ NONGIT_OK=Yes
 
 valid_tool() {
        case "$1" in
-               firefox | iceweasel | konqueror | w3m | links | lynx | dillo)
+               firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open)
                        ;; # happy
                *)
                        return 1
@@ -34,8 +34,8 @@ valid_tool() {
 }
 
 init_browser_path() {
-       browser_path=`git config browser.$1.path`
-       test -z "$browser_path" && browser_path=$1
+       browser_path=$(git config "browser.$1.path")
+       test -z "$browser_path" && browser_path="$1"
 }
 
 while test $# != 0
@@ -104,6 +104,10 @@ if test -z "$browser" ; then
     else
        browser_candidates="w3m links lynx"
     fi
+    # SECURITYSESSIONID indicates an OS X GUI login session
+    if test -n "$SECURITYSESSIONID"; then
+       browser_candidates="open $browser_candidates"
+    fi
 
     for i in $browser_candidates; do
        init_browser_path $i
@@ -129,7 +133,7 @@ case "$browser" in
        vers=$(expr "$($browser_path -version)" : '.* \([0-9][0-9]*\)\..*')
        NEWTAB='-new-tab'
        test "$vers" -lt 2 && NEWTAB=''
-       nohup "$browser_path" $NEWTAB "$@" &
+       "$browser_path" $NEWTAB "$@" &
        ;;
     konqueror)
        case "$(basename "$browser_path")" in
@@ -143,14 +147,14 @@ case "$browser" in
                eval "$browser_path" newTab "$@"
                ;;
            *)
-               nohup "$browser_path" "$@" &
+               "$browser_path" "$@" &
                ;;
        esac
        ;;
-    w3m|links|lynx)
+    w3m|links|lynx|open)
        eval "$browser_path" "$@"
        ;;
     dillo)
-       nohup "$browser_path" "$@" &
+       "$browser_path" "$@" &
        ;;
 esac