From 5884f1fe96b33d9666a78e660042b1e3e5f9f4d9 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 2 Feb 2008 07:32:53 +0100 Subject: Rename 'git-help--browse.sh' to 'git-web--browse.sh'. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- git-web--browse.sh | 156 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100755 git-web--browse.sh (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh new file mode 100755 index 0000000000..8ed489d882 --- /dev/null +++ b/git-web--browse.sh @@ -0,0 +1,156 @@ +#!/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_tool() { + case "$1" in + firefox | iceweasel | konqueror | w3m | links | lynx | dillo) + ;; # happy + *) + return 1 + ;; + esac +} + +init_browser_path() { + browser_path=`git config browser.$1.path` + test -z "$browser_path" && 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 konqueror w3m links lynx dillo" + if test "$KDE_FULL_SESSION" = "true"; then + browser_candidates="konqueror $browser_candidates" + fi + else + browser_candidates="w3m links lynx" + 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 ! 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) + # 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='' + nohup "$browser_path" $NEWTAB "$@" & + ;; + 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." + eval "$browser_path" newTab "$@" + ;; + kfmclient) + eval "$browser_path" newTab "$@" + ;; + *) + nohup "$browser_path" "$@" & + ;; + esac + ;; + w3m|links|lynx) + eval "$browser_path" "$@" + ;; + dillo) + nohup "$browser_path" "$@" & + ;; +esac -- cgit v1.2.3 From a0685a4f45ac8916212188032f75d4acb4031089 Mon Sep 17 00:00:00 2001 From: Dmitry Potapov Date: Sat, 9 Feb 2008 23:22:22 -0800 Subject: git-web--browse: do not start the browser with nohup There is no good reason to run GUI browsers using "nohup". It does not solve any real problem but creates annoying "nohup.out" files in every directory where git help -w is run. Signed-off-by: Dmitry Potapov Signed-off-by: Junio C Hamano --- git-web--browse.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 8ed489d882..2c51f361d1 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -129,7 +129,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,7 +143,7 @@ case "$browser" in eval "$browser_path" newTab "$@" ;; *) - nohup "$browser_path" "$@" & + "$browser_path" "$@" & ;; esac ;; @@ -151,6 +151,6 @@ case "$browser" in eval "$browser_path" "$@" ;; dillo) - nohup "$browser_path" "$@" & + "$browser_path" "$@" & ;; esac -- cgit v1.2.3 From 193ad4f63c511948050079ddbe8c9b7342bf85a4 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Sat, 9 Feb 2008 07:11:01 +0100 Subject: web--browse: Add a few quotes in 'init_browser_path'. These changes were made to the 'init_browser_path' function in 'git-instaweb.sh', but was not in 'git-web--browse.sh'. [jc: the quoting was screwy and did not quote $1 correctly, so I fixed it up.] Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- git-web--browse.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 2c51f361d1..3ade500e0c 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -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 -- cgit v1.2.3 From 8e08689959a78bb4f27e010fbd225b4bf3addadb Mon Sep 17 00:00:00 2001 From: "jaysoffian+git@gmail.com" Date: Mon, 11 Feb 2008 10:57:34 -0500 Subject: git-web--browse: fix misplaced quote in init_browser_path() git "config browser.$1.path" should be git config "browser.$1.path" Signed-off-by: Jay Soffian Signed-off-by: Junio C Hamano --- git-web--browse.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 3ade500e0c..fbf29cbe16 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -34,7 +34,7 @@ valid_tool() { } init_browser_path() { - browser_path=$(git "config browser.$1.path") + browser_path=$(git config "browser.$1.path") test -z "$browser_path" && browser_path="$1" } -- cgit v1.2.3 From 77e21533a938b886ed2b8636a75f76870f4805de Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 14 Mar 2008 05:56:49 +0100 Subject: web--browse: use custom commands defined at config time Currently "git web--browse" is restricted to a set of commands defined in the script. You can subvert the "browser..path" to force "git web--browse" to use a different command, but if you have a command whose invocation syntax does not match one of the current tools then you would have to write a wrapper script for it. This patch adds a git config variable "browser..cmd" which allows a more flexible browser choice. If you run "git web--browse" with -t/--tool, -b/--browser or the "web.browser" config variable set to an unrecognized tool then "git web--browse" will query the "browser..cmd" config variable. If this variable exists, then "git web--browse" will treat the specified tool as a custom command and will use a shell eval to run the command with the URLs added as extra parameters. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- git-web--browse.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 1023b90859..384148a59f 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -23,12 +23,18 @@ USAGE='[--browser=browser|--tool=browser] [--config=conf.var] url/file ...' 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 | open) ;; # happy *) - return 1 + valid_custom_tool "$1" || return 1 ;; esac } @@ -122,7 +128,7 @@ else 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 @@ -157,4 +163,9 @@ case "$browser" in dillo) "$browser_path" "$@" & ;; + *) + if test -n "$browser_cmd"; then + ( eval $browser_cmd "$@" ) + fi + ;; esac -- cgit v1.2.3 From 3b9b1163c0a316c50715c6bd7c731b4703f89f55 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 24 Sep 2008 23:52:39 +0200 Subject: git-web--browse: Support for using /bin/start on MinGW In the future, I think we should also default to xdg-open on Linux instead of having a KDE-specific hack. This patch has been sponsored by Novartis. Signed-off-by: Petr Baudis Signed-off-by: Shawn O. Pearce --- git-web--browse.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 384148a59f..78d236b77f 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,7 +31,7 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open) + firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 @@ -114,6 +114,10 @@ if test -z "$browser" ; then 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 @@ -157,7 +161,7 @@ case "$browser" in ;; esac ;; - w3m|links|lynx|open) + w3m|links|lynx|open|start) eval "$browser_path" "$@" ;; dillo) -- cgit v1.2.3 From f6b98e46bdf64454d7c6ab76d617237118799d7b Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Sun, 8 Feb 2009 18:12:43 -0500 Subject: git-web--browse: Fix check for /bin/start The previous check in git-web--browse for /bin/start used test -n /bin/start, which was always true. This lead to "start" being tried first in the browser list. On systems with upstart installed, "start" exists and might be in the PATH, but it makes a poor choice for a web browser. Instead, test that /bin/start exists and is executable. Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- git-web--browse.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 78d236b77f..7ed0faddcd 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -115,7 +115,7 @@ if test -z "$browser" ; then browser_candidates="open $browser_candidates" fi # /bin/start indicates MinGW - if test -n /bin/start; then + if test -x /bin/start; then browser_candidates="start $browser_candidates" fi -- cgit v1.2.3 From 7b66da2762025fe38ae426bdae5b288a88028e16 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Sun, 31 May 2009 18:15:20 +0200 Subject: git: browsing paths with spaces when using the start command msysGit issue 258 tracks a problem opening a browser onto file paths that contain spaces or parentheses when calling the web--browse script. This patch modifies how the start command is called to solve this. Signed-off-by: Pat Thoyts Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- git-web--browse.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 7ed0faddcd..4f5c740df5 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -161,9 +161,12 @@ case "$browser" in ;; esac ;; - w3m|links|lynx|open|start) + w3m|links|lynx|open) eval "$browser_path" "$@" ;; + start) + exec "$browser_path" '"web-browse"' "$@" + ;; dillo) "$browser_path" "$@" & ;; -- cgit v1.2.3 From 20f34902d154f390ebaa7eed7f42ad14140b8acb Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Mon, 14 Sep 2009 10:49:01 +0200 Subject: web--browse: fix Mac OS X GUI detection for 10.6 Since OS X 10.6 the variable $SECURITYSESSIONID does not exist anymore, so lets look for the $TERM_PROGRAM variable as backup. Signed-off-by: Heiko Voigt Signed-off-by: Junio C Hamano --- git-web--browse.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 4f5c740df5..a578c3a732 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -111,7 +111,8 @@ if test -z "$browser" ; then browser_candidates="w3m links lynx" fi # SECURITYSESSIONID indicates an OS X GUI login session - if test -n "$SECURITYSESSIONID"; then + if test -n "$SECURITYSESSIONID" \ + -o "$TERM_PROGRAM" = "Apple_Terminal" ; then browser_candidates="open $browser_candidates" fi # /bin/start indicates MinGW -- cgit v1.2.3 From 0b3261b84da92011f82ac9f2b9a8e89ac4a5bb04 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Sun, 30 May 2010 00:06:51 +0530 Subject: git-web--browse: Add support for google chrome and chromium Add support for google's chrome & chromium. The value of the browser is 'chromium' or 'chrome' to select it. You can always provide config variable for browser path if they are not installed in right paths. Signed-off-by: Pavan Kumar Sunkara Signed-off-by: Junio C Hamano --- git-web--browse.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index a578c3a732..dbded76aaf 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,7 +31,7 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | konqueror | w3m | links | lynx | dillo | open | start) + firefox | iceweasel | chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 @@ -103,7 +103,7 @@ fi if test -z "$browser" ; then if test -n "$DISPLAY"; then - browser_candidates="firefox iceweasel konqueror w3m links lynx dillo" + browser_candidates="firefox iceweasel chrome chromium konqueror w3m links lynx dillo" if test "$KDE_FULL_SESSION" = "true"; then browser_candidates="konqueror $browser_candidates" fi @@ -146,6 +146,11 @@ case "$browser" in test "$vers" -lt 2 && NEWTAB='' "$browser_path" $NEWTAB "$@" & ;; + chrome|chromium) + # Actual command for chromium is chromium-browser. + # No need to specify newTab. It's default in chromium + eval "$browser_path" "$@" & + ;; konqueror) case "$(basename "$browser_path")" in konqueror) -- cgit v1.2.3 From ec136663c7d5a8e2ce1664ce79f2297e2e61c86f Mon Sep 17 00:00:00 2001 From: "Nathan W. Panike" Date: Thu, 22 Jul 2010 11:58:20 -0500 Subject: Add a google-chrome option for web--browse On some systems, the chrome browser is named google-chrome. We add support for this case. Signed-off-by: Nathan W. Panike Signed-off-by: Junio C Hamano --- git-web--browse.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index dbded76aaf..3fc4166b25 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,7 +31,7 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) + firefox | iceweasel | chrome | google-chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 @@ -103,7 +103,7 @@ fi if test -z "$browser" ; then if test -n "$DISPLAY"; then - browser_candidates="firefox iceweasel chrome chromium konqueror w3m links lynx dillo" + browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror w3m links lynx dillo" if test "$KDE_FULL_SESSION" = "true"; then browser_candidates="konqueror $browser_candidates" fi @@ -146,7 +146,7 @@ case "$browser" in test "$vers" -lt 2 && NEWTAB='' "$browser_path" $NEWTAB "$@" & ;; - chrome|chromium) + google-chrome|chrome|chromium) # Actual command for chromium is chromium-browser. # No need to specify newTab. It's default in chromium eval "$browser_path" "$@" & -- cgit v1.2.3 From a180055a47c6793eaaba6289f623cff32644215b Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 3 Dec 2010 17:47:36 +0100 Subject: web--browse: coding style Retab and deindent choices in case statements. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- git-web--browse.sh | 166 ++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 3fc4166b25..7c4568fc23 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,11 +31,11 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | chrome | google-chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) - ;; # happy - *) - valid_custom_tool "$1" || return 1 - ;; + firefox | iceweasel | chrome | google-chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) + ;; # happy + *) + valid_custom_tool "$1" || return 1 + ;; esac } @@ -46,139 +46,139 @@ init_browser_path() { while test $# != 0 do - case "$1" in + case "$1" in -b|--browser*|-t|--tool*) - case "$#,$1" in + case "$#,$1" in *,*=*) - browser=`expr "z$1" : 'z-[^=]*=\(.*\)'` - ;; + browser=`expr "z$1" : 'z-[^=]*=\(.*\)'` + ;; 1,*) - usage ;; + usage ;; *) - browser="$2" - shift ;; - esac - ;; + browser="$2" + shift ;; + esac + ;; -c|--config*) - case "$#,$1" in + case "$#,$1" in *,*=*) - conf=`expr "z$1" : 'z-[^=]*=\(.*\)'` - ;; + conf=`expr "z$1" : 'z-[^=]*=\(.*\)'` + ;; 1,*) - usage ;; + usage ;; *) - conf="$2" - shift ;; - esac - ;; + conf="$2" + shift ;; + esac + ;; --) - break - ;; + break + ;; -*) - usage - ;; + usage + ;; *) - break - ;; - esac - shift + 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 + 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 konqueror w3m links lynx dillo" - if test "$KDE_FULL_SESSION" = "true"; then - browser_candidates="konqueror $browser_candidates" + if test -n "$DISPLAY"; then + browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror w3m links lynx dillo" + if test "$KDE_FULL_SESSION" = "true"; then + browser_candidates="konqueror $browser_candidates" + fi + 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" \ - -o "$TERM_PROGRAM" = "Apple_Terminal" ; 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 + # SECURITYSESSIONID indicates an OS X GUI login session + if test -n "$SECURITYSESSIONID" \ + -o "$TERM_PROGRAM" = "Apple_Terminal" ; then + browser_candidates="open $browser_candidates" fi - done - test -z "$browser" && die "No known browser available." + # /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'." + valid_tool "$browser" || die "Unknown browser '$browser'." - init_browser_path "$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 + 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) +firefox|iceweasel) # 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) +google-chrome|chrome|chromium) # Actual command for chromium is chromium-browser. # No need to specify newTab. It's default in chromium eval "$browser_path" "$@" & ;; - konqueror) +konqueror) case "$(basename "$browser_path")" in - konqueror) + 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." eval "$browser_path" newTab "$@" ;; - kfmclient) + kfmclient) eval "$browser_path" newTab "$@" ;; - *) + *) "$browser_path" "$@" & ;; esac ;; - w3m|links|lynx|open) +w3m|links|lynx|open) eval "$browser_path" "$@" ;; - start) - exec "$browser_path" '"web-browse"' "$@" - ;; - dillo) +start) + exec "$browser_path" '"web-browse"' "$@" + ;; +dillo) "$browser_path" "$@" & ;; - *) +*) if test -n "$browser_cmd"; then - ( eval $browser_cmd "$@" ) + ( eval $browser_cmd "$@" ) fi ;; esac -- cgit v1.2.3 From b968708b3ed486a25c65a8481af927ab3884bfba Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 3 Dec 2010 17:47:37 +0100 Subject: web--browse: split valid_tool list It was getting too long, and we want to add some more. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- git-web--browse.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index 7c4568fc23..bb3a669f11 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,7 +31,8 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | chrome | google-chrome | chromium | konqueror | w3m | links | lynx | dillo | open | start) + firefox | iceweasel | chrome | google-chrome | chromium | \ + konqueror | w3m | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 -- cgit v1.2.3 From 81f42f11496b9117273939c98d270af273c8a463 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 3 Dec 2010 17:47:38 +0100 Subject: web--browse: support opera, seamonkey and elinks The list of supported browsers is also updated in the documentation. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- git-web--browse.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index bb3a669f11..c108eefb48 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,8 +31,8 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | chrome | google-chrome | chromium | \ - konqueror | w3m | links | lynx | dillo | open | start) + firefox | iceweasel | seamonkey | iceape | chrome | google-chrome | chromium | \ + konqueror | opera | w3m | elinks | links | lynx | dillo | open | start) ;; # happy *) valid_custom_tool "$1" || return 1 @@ -104,12 +104,12 @@ fi if test -z "$browser" ; then if test -n "$DISPLAY"; then - browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror w3m links lynx dillo" + browser_candidates="firefox iceweasel google-chrome chrome chromium 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 links lynx" + browser_candidates="w3m elinks links lynx" fi # SECURITYSESSIONID indicates an OS X GUI login session if test -n "$SECURITYSESSIONID" \ @@ -140,7 +140,7 @@ else fi case "$browser" in -firefox|iceweasel) +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' @@ -168,13 +168,13 @@ konqueror) ;; esac ;; -w3m|links|lynx|open) +w3m|elinks|links|lynx|open) eval "$browser_path" "$@" ;; start) exec "$browser_path" '"web-browse"' "$@" ;; -dillo) +opera|dillo) "$browser_path" "$@" & ;; *) -- cgit v1.2.3 From 14ea67c0071804b7eb73cca35c87860f8fc6db95 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 3 Dec 2010 17:47:39 +0100 Subject: web--browse: better support for chromium On Debian-based distributions, Chromium the browser is available under the name chromium-browser rather than chromium, to prevent conflicts with the Chromium B.S.U. game. Look for chromium-browser first when setting the path for chromium, and also add chromium-browser as a supported browser name. Document the dual-name support, and mention the dual-name support for (google-)chrome too. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- git-web--browse.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'git-web--browse.sh') diff --git a/git-web--browse.sh b/git-web--browse.sh index c108eefb48..e9de241dd0 100755 --- a/git-web--browse.sh +++ b/git-web--browse.sh @@ -31,7 +31,8 @@ valid_custom_tool() valid_tool() { case "$1" in - firefox | iceweasel | seamonkey | iceape | chrome | google-chrome | chromium | \ + firefox | iceweasel | seamonkey | iceape | \ + chrome | google-chrome | chromium | chromium-browser |\ konqueror | opera | w3m | elinks | links | lynx | dillo | open | start) ;; # happy *) @@ -42,7 +43,13 @@ valid_tool() { init_browser_path() { browser_path=$(git config "browser.$1.path") - test -z "$browser_path" && browser_path="$1" + 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 @@ -104,7 +111,7 @@ fi if test -z "$browser" ; then if test -n "$DISPLAY"; then - browser_candidates="firefox iceweasel google-chrome chrome chromium konqueror opera seamonkey iceape w3m elinks links lynx dillo" + 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 @@ -147,8 +154,7 @@ firefox|iceweasel|seamonkey|iceape) test "$vers" -lt 2 && NEWTAB='' "$browser_path" $NEWTAB "$@" & ;; -google-chrome|chrome|chromium) - # Actual command for chromium is chromium-browser. +google-chrome|chrome|chromium|chromium-browser) # No need to specify newTab. It's default in chromium eval "$browser_path" "$@" & ;; -- cgit v1.2.3