From: Markus Heidelberg <markus.heidelberg@web.de>
To: Junio C Hamano <gitster@pobox.com>,
"Shawn O. Pearce" <spearce@spearce.org>
Cc: git@vger.kernel.org
Subject: [PATCH 2/2 resend] git-gui: use `git --html-path` to get the location of installed HTML docs
Date: Sun, 5 Apr 2009 03:48:21 +0200 [thread overview]
Message-ID: <200904050348.22103.markus.heidelberg@web.de> (raw)
In-Reply-To: <200904050333.46453.markus.heidelberg@web.de>
Previously a hardcoded path $GIT_EXEC_PATH/../Documentation/ was used to
search for the documentation, when the user has asked for it via menu
"Help -> Online Documentation".
This didn't work for the default directory structure.
To find the path reliably, use the new git command line option, which
returns the correct path.
If the output of `git --html-path` is empty because git is not found or
the option is not yet supported in the installed git, the documentation
from kernel.org is launched. There is no additional guessing of the
right location of the installed docs.
Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
Resend since the other mail didn't reach the list. This problem happens
far too often to me.
git-gui.sh | 33 +++++++++++++++++++++++++++++----
1 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/git-gui.sh b/git-gui.sh
index b3aa732..259251b 100755
--- a/git-gui.sh
+++ b/git-gui.sh
@@ -122,6 +122,7 @@ unset oguimsg
set _appname {Git Gui}
set _gitdir {}
set _gitexec {}
+set _githtmldir {}
set _reponame {}
set _iscygwin {}
set _search_path {}
@@ -168,6 +169,28 @@ proc gitexec {args} {
return [eval [list file join $_gitexec] $args]
}
+proc githtmldir {args} {
+ global _githtmldir
+ if {$_githtmldir eq {}} {
+ if {[catch {set _githtmldir [git --html-path]}]} {
+ # Git not installed or option not yet supported
+ return {}
+ }
+ if {[is_Cygwin]} {
+ set _githtmldir [exec cygpath \
+ --windows \
+ --absolute \
+ $_githtmldir]
+ } else {
+ set _githtmldir [file normalize $_githtmldir]
+ }
+ }
+ if {$args eq {}} {
+ return $_githtmldir
+ }
+ return [eval [list file join $_githtmldir] $args]
+}
+
proc reponame {} {
return $::_reponame
}
@@ -2591,11 +2614,13 @@ if {![is_MacOSX]} {
}
-set doc_path [file dirname [gitexec]]
-set doc_path [file join $doc_path Documentation index.html]
+set doc_path [githtmldir]
+if {$doc_path ne {}} {
+ set doc_path [file join $doc_path index.html]
-if {[is_Cygwin]} {
- set doc_path [exec cygpath --mixed $doc_path]
+ if {[is_Cygwin]} {
+ set doc_path [exec cygpath --mixed $doc_path]
+ }
}
if {[file isfile $doc_path]} {
--
1.6.2.2.405.ge9fc3
prev parent reply other threads:[~2009-04-05 1:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-05 1:33 [PATCH 0/2] Reliably open the installed HTML docs from git-gui Markus Heidelberg
2009-04-05 1:35 ` [PATCH 1/2] add --html-path to get the location of installed HTML docs Markus Heidelberg
2009-04-05 2:15 ` [PATCH v2 " Markus Heidelberg
2009-04-05 1:48 ` Markus Heidelberg [this message]
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=200904050348.22103.markus.heidelberg@web.de \
--to=markus.heidelberg@web.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.org \
/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