Configurable hyperlinking in gitk #4

Open
wants to merge 1 commit into
from

Projects

None yet

2 participants

@keszybz
Contributor
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.

@jepler @keszybz jepler Configurable hyperlinking in gitk
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 <jepler@unpythonic.net>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>

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.
8d0d71a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment