git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: jaysoffian+git@gmail.com
Cc: git@vger.kernel.org, Jay Soffian <jaysoffian@gmail.com>
Subject: Re: [PATCH] git-web--browse: improve browser support under OS X
Date: Sun, 10 Feb 2008 19:01:56 -0800	[thread overview]
Message-ID: <7vve4wb3h7.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1202696664-1565-1-git-send-email-jaysoffian+git@gmail.com

Because we preprocess git-web--browse.sh to create the final
git-web--browse to be installed, something like "open" that is
not a user but a platform preference might be better done as a
build-time thing, instead of forcing everybody to spawn "uname",
perhaps like this?

Also I wonder why the check for SECURITYSESSIONID your original
had is not good enough for this Mac specific customization?


 Makefile           |    2 ++
 git-web--browse.sh |   18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index d288378..5c278d2 100644
--- a/Makefile
+++ b/Makefile
@@ -419,6 +419,7 @@ ifeq ($(uname_S),Darwin)
 	endif
 	NO_STRLCPY = YesPlease
 	NO_MEMMEM = YesPlease
+	PLATFORM_BROWSER = open
 endif
 ifeq ($(uname_S),SunOS)
 	NEEDS_SOCKET = YesPlease
@@ -840,6 +841,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
+	    -e 's/@@PLATFORM_BROWSER@@/$(PLATFORM_BROWSER)/g' \
 	    $@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
diff --git a/git-web--browse.sh b/git-web--browse.sh
index 3ade500..61a3514 100755
--- a/git-web--browse.sh
+++ b/git-web--browse.sh
@@ -27,6 +27,8 @@ valid_tool() {
 	case "$1" in
 		firefox | iceweasel | konqueror | w3m | links | lynx | dillo)
 			;; # happy
+		"@@PLATFORM_BROWSER@@" )
+			;;
 		*)
 			return 1
 			;;
@@ -105,6 +107,20 @@ if test -z "$browser" ; then
 	browser_candidates="w3m links lynx"
     fi
 
+    # Test if the current environment is suitable for the
+    # platform preference and add it as the default
+
+    if	case "@@PLATFORM_BROWSER@@" in
+	open)
+		test -n "$SECURITYSESSIONID" ;;
+	# other platform preference come here...
+	*)
+		false ;;
+	esac
+    then
+	browser_candidates="@@PLATFORM_BROWSER@@ $browser_candidates"
+    fi
+
     for i in $browser_candidates; do
 	init_browser_path $i
 	if type "$browser_path" > /dev/null 2>&1; then
@@ -147,7 +163,7 @@ case "$browser" in
 		;;
 	esac
 	;;
-    w3m|links|lynx)
+    w3m|links|lynx|open)
 	eval "$browser_path" "$@"
 	;;
     dillo)

  reply	other threads:[~2008-02-11  3:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08 21:23 [PATCH] Improve git-help--browse browser support under OS X jaysoffian+git
2008-02-09 20:20 ` Dmitry Potapov
2008-02-10  2:15   ` Jay Soffian
2008-02-10 12:43     ` Dmitry Potapov
2008-02-10 13:45       ` Christian Couder
2008-02-11  2:13         ` Jay Soffian
2008-02-11  5:03           ` Christian Couder
2008-02-11  2:10       ` Jay Soffian
2008-02-11  2:24 ` [PATCH] git-web--browse: improve " jaysoffian+git
2008-02-11  3:01   ` Junio C Hamano [this message]
2008-02-11 14:15     ` Jay Soffian
2008-02-12 16:40     ` Jay Soffian
2008-02-13  6:55       ` Christian Couder
2008-02-13 22:14         ` Junio C Hamano
2008-02-13 22:46           ` Pieter de Bie
2008-02-14  0:13             ` Jay Soffian
2008-02-14  5:09               ` Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vve4wb3h7.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian+git@gmail.com \
    --cc=jaysoffian@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).