PATH:
usr
/
libexec
/
git-core
#!/bin/sh # # This program launch a web browser on the html page # describing a git command. # # Copyright (c) 2007 Christian Couder # Copyright (c) 2006 Theodore Y. Ts'o # # This file is heavily stolen from git-mergetool.sh, by # Theodore Y. Ts'o (thanks) that is: # # Copyright (c) 2006 Theodore Y. Ts'o # # This file is licensed under the GPL v2, or a later version # at the discretion of Junio C Hamano or any other official # git maintainer. # USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...' # This must be capable of running outside of git directory, so # the vanilla git-sh-setup should not be used. 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 | seamonkey | iceape | \ chrome | google-chrome | chromium | chromium-browser |\ konqueror | opera | w3m | elinks | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 ;; esac } init_browser_path() { browser_path=$(git config "browser.$1.path") 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 do case "$1" in -b|--browser*|-t|--tool*) case "$#,$1" in *,*=*) browser=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; 1,*) usage ;; *) browser="$2" shift ;; esac ;; -c|--config*) case "$#,$1" in *,*=*) conf=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;; 1,*) usage ;; *) conf="$2" shift ;; esac ;; --) break ;; -*) usage ;; *) break ;; esac shift done test $# = 0 && usage if test -z "$browser" then for opt in "$conf" "web.browser" do test -z "$opt" && continue browser="`git config $opt`" test -z "$browser" || break done if test -n "$browser" && ! valid_tool "$browser"; then echo >&2 "git config option $opt set to unknown browser: $browser" echo >&2 "Resetting to default..." unset browser fi fi if test -z "$browser" ; then if test -n "$DISPLAY"; then 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 elinks links lynx" fi # SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" || test -n "$TERM_PROGRAM" then browser_candidates="open $browser_candidates" fi # /bin/start indicates MinGW if test -x /bin/start; then browser_candidates="start $browser_candidates" fi for i in $browser_candidates; do init_browser_path $i if type "$browser_path" > /dev/null 2>&1; then browser=$i break fi done test -z "$browser" && die "No known browser available." else valid_tool "$browser" || die "Unknown browser '$browser'." init_browser_path "$browser" 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 case "$browser" in 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|chromium-browser) # No need to specify newTab. It's default in chromium "$browser_path" "$@" & ;; konqueror) case "$(basename "$browser_path")" in 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." "$browser_path" newTab "$@" & ;; kfmclient) "$browser_path" newTab "$@" & ;; *) "$browser_path" "$@" & ;; esac ;; w3m|elinks|links|lynx|open) "$browser_path" "$@" ;; start) exec "$browser_path" '"web-browse"' "$@" ;; opera|dillo) "$browser_path" "$@" & ;; *) if test -n "$browser_cmd"; then ( eval "$browser_cmd \"\$@\"" ) fi ;; esac
[+]
..
[-] git-sh-setup
[edit]
[-] git-bisect--helper
[edit]
[-] git-check-attr
[edit]
[-] git-show
[edit]
[-] git-receive-pack
[edit]
[-] git-bundle
[edit]
[-] git-config
[edit]
[-] git-merge-recursive
[edit]
[-] git-imap-send
[edit]
[-] git-remote-testpy
[edit]
[-] git-revert
[edit]
[-] git-mergetool
[edit]
[-] git-rev-parse
[edit]
[-] git-sh-i18n--envsubst
[edit]
[-] git-fast-export
[edit]
[-] git-fmt-merge-msg
[edit]
[-] git-whatchanged
[edit]
[-] git-submodule--helper
[edit]
[-] git-reflog
[edit]
[-] git-column
[edit]
[-] git-prune-packed
[edit]
[-] git-credential-cache
[edit]
[-] git-upload-pack
[edit]
[-] git
[edit]
[-] git-remote-http
[edit]
[-] git-difftool
[edit]
[-] git-request-pull
[edit]
[-] git-merge-subtree
[edit]
[-] git-parse-remote
[edit]
[-] git-fetch-pack
[edit]
[-] git-send-pack
[edit]
[-] git-diff-index
[edit]
[-] git-cherry
[edit]
[-] git-ls-files
[edit]
[-] git-show-index
[edit]
[-] git-unpack-objects
[edit]
[-] git-write-tree
[edit]
[-] git-upload-archive
[edit]
[-] git-merge-index
[edit]
[-] git-gc
[edit]
[-] git-init-db
[edit]
[-] git-diff
[edit]
[-] git-credential
[edit]
[-] git-notes
[edit]
[-] git-for-each-ref
[edit]
[-] git-symbolic-ref
[edit]
[-] git-diff-files
[edit]
[-] git-fetch
[edit]
[-] git-merge-tree
[edit]
[-] git-update-index
[edit]
[-] git-diff-tree
[edit]
[-] git-commit
[edit]
[-] git-tag
[edit]
[-] git-cat-file
[edit]
[-] git-remote-fd
[edit]
[-] git-rebase--merge
[edit]
[-] git-bisect
[edit]
[-] git-sh-i18n
[edit]
[-] git-cherry-pick
[edit]
[-] git-checkout-index
[edit]
[-] git-credential-store
[edit]
[-] git-annotate
[edit]
[-] git-stage
[edit]
[-] git-remote-https
[edit]
[-] git-patch-id
[edit]
[-] git-branch
[edit]
[-] git-var
[edit]
[-] git-rm
[edit]
[-] git-help
[edit]
[-] git-commit-tree
[edit]
[-] git-merge
[edit]
[-] git-reset
[edit]
[-] git-stripspace
[edit]
[-] git-pack-refs
[edit]
[-] git-lost-found
[edit]
[-] git-show-ref
[edit]
[-] git-update-server-info
[edit]
[-] git-check-ignore
[edit]
[-] git-am
[edit]
[-] git-check-ref-format
[edit]
[-] git-hash-object
[edit]
[-] git-ls-tree
[edit]
[-] git-apply
[edit]
[-] git-format-patch
[edit]
[-] git-verify-tag
[edit]
[-] git-fsck-objects
[edit]
[-] git-tar-tree
[edit]
[-] git-read-tree
[edit]
[-] git-update-ref
[edit]
[-] git-count-objects
[edit]
[-] git-fast-import
[edit]
[-] git-mergetool--lib
[edit]
[-] git-push
[edit]
[-] git-subtree
[edit]
[-] git-rebase--am
[edit]
[-] git-merge-ours
[edit]
[-] git-remote-ftps
[edit]
[-] git-blame
[edit]
[-] git-init
[edit]
[-] git-merge-one-file
[edit]
[-] git-show-branch
[edit]
[-] git-clone
[edit]
[-] git-rebase
[edit]
[-] git-remote
[edit]
[-] git-rerere
[edit]
[-] git-ls-remote
[edit]
[-] git-merge-resolve
[edit]
[-] git-rev-list
[edit]
[-] git-pack-objects
[edit]
[-] git-fsck
[edit]
[-] git-rebase--interactive
[edit]
[-] git-mv
[edit]
[-] git-unpack-file
[edit]
[-] git-http-fetch
[edit]
[-] git-shell
[edit]
[-] git-status
[edit]
[-] git-shortlog
[edit]
[-] git-verify-pack
[edit]
[-] git-name-rev
[edit]
[+]
mergetools
[-] git-merge-file
[edit]
[-] git-web--browse
[edit]
[-] git-remote-ext
[edit]
[-] git-grep
[edit]
[-] git-mktree
[edit]
[-] git-credential-cache--daemon
[edit]
[-] git-stash
[edit]
[-] git-add--interactive
[edit]
[-] git-checkout
[edit]
[-] git-pull
[edit]
[-] git-replace
[edit]
[-] git-merge-octopus
[edit]
[-] git-mailsplit
[edit]
[-] git-clean
[edit]
[-] git-repack
[edit]
[-] git-add
[edit]
[-] git-peek-remote
[edit]
[-] git-http-push
[edit]
[-] git-log
[edit]
[-] git-prune
[edit]
[-] git-get-tar-commit-id
[edit]
[-] git-repo-config
[edit]
[-] git-mktag
[edit]
[-] git-http-backend
[edit]
[-] git-index-pack
[edit]
[-] git-difftool--helper
[edit]
[-] git-submodule
[edit]
[-] git-relink
[edit]
[-] git-remote-ftp
[edit]
[-] git-merge-base
[edit]
[-] git-describe
[edit]
[-] git-filter-branch
[edit]
[-] git-mailinfo
[edit]
[-] git-archive
[edit]
[-] git-pack-redundant
[edit]
[-] git-quiltimport
[edit]