NONGIT_OK=Yes
. git-sh-setup
+valid_custom_tool()
+{
+ browser_cmd="$(git config "browser.$1.cmd")"
+ test -n "$browser_cmd"
+}
+
valid_tool() {
case "$1" in
- firefox | iceweasel | konqueror | w3m | links | lynx | dillo)
+ firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start)
;; # happy
*)
- return 1
+ valid_custom_tool "$1" || return 1
;;
esac
}
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
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
+ # /bin/start indicates MinGW
+ if test -n /bin/start; then
+ browser_candidates="start $browser_candidates"
+ fi
for i in $browser_candidates; do
init_browser_path $i
init_browser_path "$browser"
- if ! type "$browser_path" > /dev/null 2>&1; then
+ if test -z "$browser_cmd" && ! type "$browser_path" > /dev/null 2>&1; then
die "The browser $browser is not available as '$browser_path'."
fi
fi
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
eval "$browser_path" newTab "$@"
;;
*)
- nohup "$browser_path" "$@" &
+ "$browser_path" "$@" &
;;
esac
;;
- w3m|links|lynx)
+ w3m|links|lynx|open|start)
eval "$browser_path" "$@"
;;
dillo)
- nohup "$browser_path" "$@" &
+ "$browser_path" "$@" &
+ ;;
+ *)
+ if test -n "$browser_cmd"; then
+ ( eval $browser_cmd "$@" )
+ fi
;;
esac