#!/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 | cygstart | xdg-open) ;; # 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 xdg-open" 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 # /usr/bin/cygstart indicates Cygwin if test -x /usr/bin/cygstart; then browser_candidates="cygstart $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|cygstart|xdg-open) "$browser_path" "$@" ;; start) exec "$browser_path" '"web-browse"' "$@" ;; opera|dillo) "$browser_path" "$@" & ;; *) if test -n "$browser_cmd"; then ( eval "$browser_cmd \"\$@\"" ) fi ;; esac
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
mergetools | Folder | 0755 |
|
|
git | File | 3.67 MB | 0755 |
|
git-add | File | 3.67 MB | 0755 |
|
git-am | File | 3.67 MB | 0755 |
|
git-annotate | File | 3.67 MB | 0755 |
|
git-apply | File | 3.67 MB | 0755 |
|
git-archive | File | 3.67 MB | 0755 |
|
git-bisect | File | 3.67 MB | 0755 |
|
git-blame | File | 3.67 MB | 0755 |
|
git-branch | File | 3.67 MB | 0755 |
|
git-bugreport | File | 3.67 MB | 0755 |
|
git-bundle | File | 3.67 MB | 0755 |
|
git-cat-file | File | 3.67 MB | 0755 |
|
git-check-attr | File | 3.67 MB | 0755 |
|
git-check-ignore | File | 3.67 MB | 0755 |
|
git-check-mailmap | File | 3.67 MB | 0755 |
|
git-check-ref-format | File | 3.67 MB | 0755 |
|
git-checkout | File | 3.67 MB | 0755 |
|
git-checkout--worker | File | 3.67 MB | 0755 |
|
git-checkout-index | File | 3.67 MB | 0755 |
|
git-cherry | File | 3.67 MB | 0755 |
|
git-cherry-pick | File | 3.67 MB | 0755 |
|
git-clean | File | 3.67 MB | 0755 |
|
git-clone | File | 3.67 MB | 0755 |
|
git-column | File | 3.67 MB | 0755 |
|
git-commit | File | 3.67 MB | 0755 |
|
git-commit-graph | File | 3.67 MB | 0755 |
|
git-commit-tree | File | 3.67 MB | 0755 |
|
git-config | File | 3.67 MB | 0755 |
|
git-contacts | File | 4.4 KB | 0755 |
|
git-count-objects | File | 3.67 MB | 0755 |
|
git-credential | File | 3.67 MB | 0755 |
|
git-credential-cache | File | 3.67 MB | 0755 |
|
git-credential-cache--daemon | File | 3.67 MB | 0755 |
|
git-credential-netrc | File | 10.69 KB | 0755 |
|
git-credential-store | File | 3.67 MB | 0755 |
|
git-describe | File | 3.67 MB | 0755 |
|
git-diagnose | File | 3.67 MB | 0755 |
|
git-diff | File | 3.67 MB | 0755 |
|
git-diff-files | File | 3.67 MB | 0755 |
|
git-diff-index | File | 3.67 MB | 0755 |
|
git-diff-tree | File | 3.67 MB | 0755 |
|
git-difftool | File | 3.67 MB | 0755 |
|
git-difftool--helper | File | 2.55 KB | 0755 |
|
git-fast-export | File | 3.67 MB | 0755 |
|
git-fast-import | File | 3.67 MB | 0755 |
|
git-fetch | File | 3.67 MB | 0755 |
|
git-fetch-pack | File | 3.67 MB | 0755 |
|
git-filter-branch | File | 15.49 KB | 0755 |
|
git-fmt-merge-msg | File | 3.67 MB | 0755 |
|
git-for-each-ref | File | 3.67 MB | 0755 |
|
git-for-each-repo | File | 3.67 MB | 0755 |
|
git-format-patch | File | 3.67 MB | 0755 |
|
git-fsck | File | 3.67 MB | 0755 |
|
git-fsck-objects | File | 3.67 MB | 0755 |
|
git-fsmonitor--daemon | File | 3.67 MB | 0755 |
|
git-gc | File | 3.67 MB | 0755 |
|
git-get-tar-commit-id | File | 3.67 MB | 0755 |
|
git-grep | File | 3.67 MB | 0755 |
|
git-hash-object | File | 3.67 MB | 0755 |
|
git-help | File | 3.67 MB | 0755 |
|
git-hook | File | 3.67 MB | 0755 |
|
git-http-backend | File | 2.14 MB | 0755 |
|
git-http-fetch | File | 2.17 MB | 0755 |
|
git-http-push | File | 2.19 MB | 0755 |
|
git-imap-send | File | 2.19 MB | 0755 |
|
git-index-pack | File | 3.67 MB | 0755 |
|
git-init | File | 3.67 MB | 0755 |
|
git-init-db | File | 3.67 MB | 0755 |
|
git-interpret-trailers | File | 3.67 MB | 0755 |
|
git-log | File | 3.67 MB | 0755 |
|
git-ls-files | File | 3.67 MB | 0755 |
|
git-ls-remote | File | 3.67 MB | 0755 |
|
git-ls-tree | File | 3.67 MB | 0755 |
|
git-mailinfo | File | 3.67 MB | 0755 |
|
git-mailsplit | File | 3.67 MB | 0755 |
|
git-maintenance | File | 3.67 MB | 0755 |
|
git-merge | File | 3.67 MB | 0755 |
|
git-merge-base | File | 3.67 MB | 0755 |
|
git-merge-file | File | 3.67 MB | 0755 |
|
git-merge-index | File | 3.67 MB | 0755 |
|
git-merge-octopus | File | 2.42 KB | 0755 |
|
git-merge-one-file | File | 3.61 KB | 0755 |
|
git-merge-ours | File | 3.67 MB | 0755 |
|
git-merge-recursive | File | 3.67 MB | 0755 |
|
git-merge-resolve | File | 1.2 KB | 0755 |
|
git-merge-subtree | File | 3.67 MB | 0755 |
|
git-merge-tree | File | 3.67 MB | 0755 |
|
git-mergetool | File | 11.42 KB | 0755 |
|
git-mergetool--lib | File | 10.48 KB | 0644 |
|
git-mktag | File | 3.67 MB | 0755 |
|
git-mktree | File | 3.67 MB | 0755 |
|
git-multi-pack-index | File | 3.67 MB | 0755 |
|
git-mv | File | 3.67 MB | 0755 |
|
git-name-rev | File | 3.67 MB | 0755 |
|
git-notes | File | 3.67 MB | 0755 |
|
git-pack-objects | File | 3.67 MB | 0755 |
|
git-pack-redundant | File | 3.67 MB | 0755 |
|
git-pack-refs | File | 3.67 MB | 0755 |
|
git-patch-id | File | 3.67 MB | 0755 |
|
git-prune | File | 3.67 MB | 0755 |
|
git-prune-packed | File | 3.67 MB | 0755 |
|
git-pull | File | 3.67 MB | 0755 |
|
git-push | File | 3.67 MB | 0755 |
|
git-quiltimport | File | 3.61 KB | 0755 |
|
git-range-diff | File | 3.67 MB | 0755 |
|
git-read-tree | File | 3.67 MB | 0755 |
|
git-rebase | File | 3.67 MB | 0755 |
|
git-receive-pack | File | 3.67 MB | 0755 |
|
git-reflog | File | 3.67 MB | 0755 |
|
git-remote | File | 3.67 MB | 0755 |
|
git-remote-ext | File | 3.67 MB | 0755 |
|
git-remote-fd | File | 3.67 MB | 0755 |
|
git-remote-ftp | File | 2.19 MB | 0755 |
|
git-remote-ftps | File | 2.19 MB | 0755 |
|
git-remote-http | File | 2.19 MB | 0755 |
|
git-remote-https | File | 2.19 MB | 0755 |
|
git-repack | File | 3.67 MB | 0755 |
|
git-replace | File | 3.67 MB | 0755 |
|
git-request-pull | File | 4.05 KB | 0755 |
|
git-rerere | File | 3.67 MB | 0755 |
|
git-reset | File | 3.67 MB | 0755 |
|
git-restore | File | 3.67 MB | 0755 |
|
git-rev-list | File | 3.67 MB | 0755 |
|
git-rev-parse | File | 3.67 MB | 0755 |
|
git-revert | File | 3.67 MB | 0755 |
|
git-rm | File | 3.67 MB | 0755 |
|
git-send-pack | File | 3.67 MB | 0755 |
|
git-sh-i18n | File | 1.64 KB | 0644 |
|
git-sh-i18n--envsubst | File | 2.13 MB | 0755 |
|
git-sh-setup | File | 8.2 KB | 0644 |
|
git-shell | File | 2.13 MB | 0755 |
|
git-shortlog | File | 3.67 MB | 0755 |
|
git-show | File | 3.67 MB | 0755 |
|
git-show-branch | File | 3.67 MB | 0755 |
|
git-show-index | File | 3.67 MB | 0755 |
|
git-show-ref | File | 3.67 MB | 0755 |
|
git-sparse-checkout | File | 3.67 MB | 0755 |
|
git-stage | File | 3.67 MB | 0755 |
|
git-stash | File | 3.67 MB | 0755 |
|
git-status | File | 3.67 MB | 0755 |
|
git-stripspace | File | 3.67 MB | 0755 |
|
git-submodule | File | 10.26 KB | 0755 |
|
git-submodule--helper | File | 3.67 MB | 0755 |
|
git-switch | File | 3.67 MB | 0755 |
|
git-symbolic-ref | File | 3.67 MB | 0755 |
|
git-tag | File | 3.67 MB | 0755 |
|
git-unpack-file | File | 3.67 MB | 0755 |
|
git-unpack-objects | File | 3.67 MB | 0755 |
|
git-update-index | File | 3.67 MB | 0755 |
|
git-update-ref | File | 3.67 MB | 0755 |
|
git-update-server-info | File | 3.67 MB | 0755 |
|
git-upload-archive | File | 3.67 MB | 0755 |
|
git-upload-pack | File | 3.67 MB | 0755 |
|
git-var | File | 3.67 MB | 0755 |
|
git-verify-commit | File | 3.67 MB | 0755 |
|
git-verify-pack | File | 3.67 MB | 0755 |
|
git-verify-tag | File | 3.67 MB | 0755 |
|
git-version | File | 3.67 MB | 0755 |
|
git-web--browse | File | 4.3 KB | 0755 |
|
git-whatchanged | File | 3.67 MB | 0755 |
|
git-worktree | File | 3.67 MB | 0755 |
|
git-write-tree | File | 3.67 MB | 0755 |
|
scalar | File | 2.18 MB | 0755 |
|