Merge branch 'cc/browser'
[git/git.git] / git-web--browse.sh
index fbf29cb..1023b90 100755 (executable)
@@ -25,7 +25,7 @@ NONGIT_OK=Yes
 
 valid_tool() {
        case "$1" in
 
 valid_tool() {
        case "$1" in
-               firefox | iceweasel | konqueror | w3m | links | lynx | dillo)
+               firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open)
                        ;; # happy
                *)
                        return 1
                        ;; # happy
                *)
                        return 1
@@ -104,6 +104,10 @@ if test -z "$browser" ; then
     else
        browser_candidates="w3m links lynx"
     fi
     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
 
     for i in $browser_candidates; do
        init_browser_path $i
@@ -147,7 +151,7 @@ case "$browser" in
                ;;
        esac
        ;;
                ;;
        esac
        ;;
-    w3m|links|lynx)
+    w3m|links|lynx|open)
        eval "$browser_path" "$@"
        ;;
     dillo)
        eval "$browser_path" "$@"
        ;;
     dillo)