{"thread":{"id":"43819","subject":"[PATCH] git-gui: Use git web--browser for web browsing","startedAt":"2008-09-24T21:57:16Z","lastAt":"2008-09-24T21:57:16Z","messageCount":1,"participants":["Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"299067","messageId":"1222293436-6245-1-git-send-email-pasky@suse.cz","threadId":"43819","inReplyTo":null,"subject":"[PATCH] git-gui: Use git web--browser for web browsing","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2008-09-24T21:57:16Z","receivedAt":"2008-09-24T21:57:16Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"This patch removes git-gui specific webbrowser guessing and instead\nrelies on git web--browser to do the right thing, removing unnecessary\ncode duplication. New function start_browser encapsulates the browser\nexecution, for usage from other parts of code. This will also make\ngit-gui show the documentation menu item even in cases it might not\nbe able to start up a browser, these cases should be however only\nvery rare.\n\nThis patch has been sponsored by Novartis.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\n git-gui/git-gui.sh |   30 +++++++-----------------------\n 1 files changed, 7 insertions(+), 23 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex 10d8a44..fc67eb8 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2345,8 +2345,7 @@ if {![is_MacOSX]} {\n \t\t-command do_about\n }\n \n-set browser {}\n-catch {set browser $repo_config(instaweb.browser)}\n+\n set doc_path [file dirname [gitexec]]\n set doc_path [file join $doc_path Documentation index.html]\n \n@@ -2354,34 +2353,19 @@ if {[is_Cygwin]} {\n \tset doc_path [exec cygpath --mixed $doc_path]\n }\n \n-if {$browser eq {}} {\n-\tif {[is_MacOSX]} {\n-\t\tset browser open\n-\t} elseif {[is_Cygwin]} {\n-\t\tset program_files [file dirname [exec cygpath --windir]]\n-\t\tset program_files [file join $program_files {Program Files}]\n-\t\tset firefox [file join $program_files {Mozilla Firefox} firefox.exe]\n-\t\tset ie [file join $program_files {Internet Explorer} IEXPLORE.EXE]\n-\t\tif {[file exists $firefox]} {\n-\t\t\tset browser $firefox\n-\t\t} elseif {[file exists $ie]} {\n-\t\t\tset browser $ie\n-\t\t}\n-\t\tunset program_files firefox ie\n-\t}\n-}\n-\n if {[file isfile $doc_path]} {\n \tset doc_url \"file:$doc_path\"\n } else {\n \tset doc_url {http://www.kernel.org/pub/software/scm/git/docs/}\n }\n \n-if {$browser ne {}} {\n-\t.mbar.help add command -label [mc \"Online Documentation\"] \\\n-\t\t-command [list exec $browser $doc_url &]\n+proc start_browser {url} {\n+\tgit \"web--browse\" $url\n }\n-unset browser doc_path doc_url\n+\n+.mbar.help add command -label [mc \"Online Documentation\"] \\\n+\t-command [list start_browser $doc_url]\n+unset doc_path doc_url\n \n # -- Standard bindings\n #\n-- \ntg: (c427559..) t/git-gui/web-browse (depends on: vanilla/master)\n"}]}