Skip to content

Commit

Permalink
web--browse: better support for chromium
Browse files Browse the repository at this point in the history
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 <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Giuseppe Bilotta authored and Junio C Hamano committed Dec 3, 2010
1 parent 81f42f1 commit 14ea67c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Documentation/git-web--browse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ The following browsers (or commands) are currently supported:
* iceweasel
* seamonkey
* iceape
* chromium
* google-chrome
* chromium (also supported as chromium-browser)
* google-chrome (also supported as chrome)
* konqueror (this is the default under KDE, see 'Note about konqueror' below)
* opera
* w3m (this is the default outside graphical environments)
Expand Down
16 changes: 11 additions & 5 deletions git-web--browse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
*)
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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" "$@" &
;;
Expand Down

0 comments on commit 14ea67c

Please sign in to comment.