Skip to content
Browse files

Add support for gitweb URLs in commit emails.

You can enable gitweb URLs in commit notification emails by setting the
parameter gitweb.baseurl for your repository.
  • Loading branch information...
1 parent c763328 commit 6991c40c2ce0cbee7d169d282e3a0962b9a52c7c @bmeurer committed
Showing with 26 additions and 0 deletions.
  1. +19 −0 hooks/post-receive.d/99gitnotify
  2. +7 −0 template/config
View
19 hooks/post-receive.d/99gitnotify
@@ -14,6 +14,8 @@
# ------
# cgit.baseurl
# The base URL of the cgit web interface (i.e. http://host.domain/cgit/).
+# gitweb.baseurl
+# The base URL of the gitweb web interface (i.e. http://host.domain/git).
# notify.mailinglist
# The mailinglist to which commit notifications should be sent. If unset,
# this hook script won't generate any commit notification emails for the
@@ -57,6 +59,9 @@ my $sendmail = '/usr/sbin/sendmail';
# cgit base URL
my $cgit_baseurl = git_config("cgit.baseurl");
+# gitweb base URL
+my $gitweb_baseurl = git_config("gitweb.baseurl");
+
# default repository name
my $notify_repository = git_repository();
@@ -206,6 +211,13 @@ sub git_send_notice($$)
. "$cgit_baseurl/$notify_repository/tag/?id="
. "$object";
}
+ if ($gitweb_baseurl)
+ {
+ push @notice,
+ "URL: "
+ . "$gitweb_baseurl/$notify_repository/?a=tag;"
+ . "h=$object";
+ }
push @notice,
"Tagger: " .
$info{'tagger'},
@@ -231,6 +243,13 @@ sub git_send_notice($$)
. "$cgit_baseurl/$notify_repository/commit/?id="
. "$object";
}
+ if ($gitweb_baseurl)
+ {
+ push @notice,
+ "URL: "
+ . "$gitweb_baseurl/$notify_repository/?a=commit;"
+ . "h=$object";
+ }
push @notice,
"Author: " . $info{'author'},
"Date: "
View
7 template/config
@@ -5,6 +5,13 @@
#[cgit]
# baseurl = http://host.domain/cgit/
+## gitweb web interface
+# Uncomment the following lines to enable inclusion of gitweb URLs in
+# commit notification emails (see the post-receive.d/99gitnotify hook
+# for details).
+#[gitweb]
+# baseurl = http://host.domain/git
+
## commit notifications
# Uncomment the following lines to enable commit notification emails
# (see the post-receive.d/99gitnotify hook for details).

0 comments on commit 6991c40

Please sign in to comment.
Something went wrong with that request. Please try again.