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.
This commit is contained in:
parent
18b7e20efb
commit
351565faaf
1 changed files with 10 additions and 5 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue