Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable hyperlinking in gitk #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keszybz
Copy link
Contributor

@keszybz keszybz commented Feb 20, 2012

Hi,
this is a patch floated on the git mailing list. Please consider adding it to your pool
of gitk patches.

Many projects use project-specific notations in changelogs to refer
to bug trackers and the like.  One example is the "Closes: #12345"
notation used in Debian.

Make gitk configurable so that arbitrary strings can be turned into
clickable links that are opened in a web browser.

[zj: updated documentation patch in the description below following
     Junio's suggestion]

Signed-off-by: Jeff Epler <[email protected]>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <[email protected]>

The following changes to documentation should go along with this patch:

diff --git a/Documentation/config.txt b/Documentation/config.txt
index ae9913b..ffc9ccf 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1064,6 +1064,10 @@ All gitcvs variables except for 'gitcvs.usecrlfattr' and
 is one of "ext" and "pserver") to make them apply only for the given
 access method.

+gitk.browser::
+	Specify the browser that will be used to open links generated by
+	'linkify' configuration options.
+
 grep.lineNumber::
 	If set to true, enable '-n' option by default.

@@ -1317,6 +1321,28 @@ interactive.singlekey::
 	setting is silently ignored if portable keystroke input
 	is not available.

+linkify.<name>.regexp::
+       A string that matches this regexp is converted to a hyperlink
+       using the value of corresponding `linkify.<name>.subst`
+       variable. The regular expression is passed to the regexp
+       engine of Tcl (in gitk) or Perl (in gitweb).
+
+linkify.<name>.subst::
+       A string matching the value of the corresponding
+       `linkify.<name>.regexp` variable is rewritten to this URL. The
+       value of this variable can contain back-references like `\1`
+       to refer to capturing groups in the associated regular expression.
++
+For example, to automatically link from Debian-style "Closes: #nnnn"
+message to the Debian BTS,
++
+--------
+    git config linkify.debian-bts.regexp '#([1-9][0-9]*)'
+    git config linkify.debian-bts.subst 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=\1'
+--------
++
+Currently, only linkgit:gitk[1] converts strings to links in this fashion.
+
 log.abbrevCommit::
 	If true, makes linkgit:git-log[1], linkgit:git-show[1], and
 	linkgit:git-whatchanged[1] assume `\--abbrev-commit`. You may
@@ -1870,5 +1896,5 @@ user.signingkey::

 web.browser::
 	Specify a web browser that may be used by some commands.
-	Currently only linkgit:git-instaweb[1] and linkgit:git-help[1]
-	may use it.
+	Currently only linkgit:git-instaweb[1], linkgit:gitk[1],
+	and linkgit:git-help[1] may use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants