Commit 351565fa authored by Pierre-Elliott Bécue's avatar Pierre-Elliott Bécue

On compatibilise git-notify avec les urls gitlab.

 * Il faut penser à changer l'attribut baseurl
 * Il faut ajouter isgitlab = 1
 * Il faut préciser gitlabowner = membres-actifs ou gitlabowner = nounous

Etc etc.
parent 18b7e20e
......@@ -52,6 +52,10 @@ my $debug = 0;
# base URL of the gitweb repository browser (can be set with the -u option)
my $gitweb_url = git_config( "notify.baseurl" );
# The git server is behind gitlab
my $is_gitlab = git_config( "notify.isgitlab" ) || "";
my $gitlab_owner = git_config( "notify.gitlabowner" ) || "";
# default repository name (can be changed with the -r option)
my $repos_name = git_config( "notify.repository" ) || get_repos_name();
......@@ -147,6 +151,7 @@ sub parse_options()
elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
elsif ($arg eq '-u') { $gitweb_url = shift @ARGV; }
elsif ($arg eq '-g') { $is_gitlab = shift @ARGV; }
elsif ($arg eq '-i') { push @include_list, shift @ARGV; }
elsif ($arg eq '-x') { push @exclude_list, shift @ARGV; }
elsif ($arg eq '-X') { push @revlist_options, "--no-merges"; }
......@@ -260,7 +265,7 @@ sub send_commit_notice($$)
"Module: $repos_name",
"Branch: $ref",
"Tag: $obj",
$gitweb_url ? "URL: $gitweb_url;a=tag;h=$obj\n" : "",
$gitweb_url ? "URL: $gitweb_url". ($is_gitlab ? "/tag/$obj\n" : ";a=tag;h=$obj\n") : "",
"Tagger: " . $info{"tagger"},
"Date: " . format_date($info{"tagger_date"},$info{"tagger_tz"}),
"",
......@@ -273,7 +278,7 @@ sub send_commit_notice($$)
"Module: $repos_name",
"Branch: $ref",
"Commit: $obj",
$gitweb_url ? "URL: $gitweb_url;a=commit;h=$obj\n" : "",
$gitweb_url ? "URL: $gitweb_url". ($is_gitlab ? "/commit/$obj\n" : ";a=commit;h=$obj\n") : "",
"Author: " . $info{"author"},
"Date: " . format_date($info{"author_date"},$info{"author_tz"}),
"",
......@@ -296,7 +301,7 @@ sub send_commit_notice($$)
}
else
{
push @notice, "Diff: $gitweb_url;a=commitdiff;h=$obj" if $gitweb_url;
push @notice, "Diff: $gitweb_url". ($is_gitlab ? "/commit/$obj" : ";a=commit;h=$obj") if $gitweb_url;
}
$subject = "Git commit ($repos_name/$ref): " . ${$info{"log"}}[0];
......@@ -352,7 +357,7 @@ sub send_cia_notice($$)
push @cia_text,
" </files>",
$gitweb_url ? " <url>" . xml_escape("$gitweb_url;a=commit;h=$commit") . "</url>" : "",
$gitweb_url ? " <url>" . xml_escape("$gitweb_url". ($is_gitlab ? "/commit/$commit" : ";a=commit;h=$commit")) . "</url>" : "",
" </commit>",
" </body>",
" <timestamp>" . $info{"author_date"} . "</timestamp>",
......@@ -422,7 +427,7 @@ sub send_all_notices($$$)
parse_options();
# append repository path to URL
$gitweb_url .= "?p=$repos_name.git" if $gitweb_url;
$gitweb_url .= $gitweb_url ? $is_gitlab ? "/$gitlab_owner/$repos_name" : "?p=$repos_name.git" : "";
if (@ARGV)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment