Configurable hyperlinking in gitk #4

wants to merge 1 commit into


None yet

2 participants

keszybz commented Feb 20, 2012

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 <>
Signed-off-by: Zbigniew Jędrzejewski-Szmek <>

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.

+	Specify the browser that will be used to open links generated by
+	'linkify' configuration options.
 	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.

+       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).
+       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 '\1'
+Currently, only linkgit:gitk[1] converts strings to links in this fashion.
 	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::

 	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