summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 71351c5)
raw | patch | inline | side by side (parent: 71351c5)
author | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 7 Nov 2009 09:40:22 +0000 (10:40 +0100) | ||
committer | Holger Weiss <holger@zedat.fu-berlin.de> | |
Sat, 7 Nov 2009 09:40:22 +0000 (10:40 +0100) |
The Gitweb URLs for repositories hosted by SourceForge are slightly
different than other Gitweb URLs. The correct URL cannot be specified
via "-u" if we append "/$repos_name.git/?" to that URL as we usually do.
If the new "-S" flag is specified or "notify.sourceforge" is set, we'll
append "/$repos_name;" instead, which makes the "-u" option usable for
SourceForge repositories.
different than other Gitweb URLs. The correct URL cannot be specified
via "-u" if we append "/$repos_name.git/?" to that URL as we usually do.
If the new "-S" flag is specified or "notify.sourceforge" is set, we'll
append "/$repos_name;" instead, which makes the "-u" option usable for
SourceForge repositories.
tools/git-notify | patch | blob | history |
diff --git a/tools/git-notify b/tools/git-notify
index b3223a87a384f85b92d913e775b786e543da0267..faa1785053bf735a90cf713da3b1992b5ca393ab 100755 (executable)
--- a/tools/git-notify
+++ b/tools/git-notify
# -m addr Send mail notifications to specified address
# -n max Set max number of individual mails to send
# -r name Set the git repository name
+# -S Enable compatibility with SourceForge's gitweb URLs
# -s bytes Set the maximum diff size in bytes (-1 for no limit)
# -T Prefix the mail subject with a [repository name] tag
# -t file Prevent duplicate notifications by saving state to this file
# abbreviate the SHA1 name within gitweb URLs (can be set with the -z option)
my $abbreviate_url = git_config( "notify.shorturls" );
+# enable compatibility with SourceForge's gitweb (can be set with the -S option)
+my $sourceforge = git_config( "notify.sourceforge" );
+
# default repository name (can be changed with the -r option)
my $repos_name = git_config( "notify.repository" ) || get_repos_name();
print " -m addr Send mail notifications to specified address\n";
print " -n max Set max number of individual mails to send\n";
print " -r name Set the git repository name\n";
+ print " -S Enable compatibility with SourceForge's gitweb URLs\n";
print " -s bytes Set the maximum diff size in bytes (-1 for no limit)\n";
print " -T Prefix the mail subject with a [repository name] tag\n";
print " -t file Prevent duplicate notifications by saving state to this file\n";
elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; }
elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; }
elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
+ elsif ($arg eq '-S') { $sourceforge = 1; }
elsif ($arg eq '-s') { $max_diff_size = shift @ARGV; }
elsif ($arg eq '-T') { $emit_repo = 1; }
elsif ($arg eq '-t') { $state_file = shift @ARGV; }
($reftype eq "tag" ? "Tag:" : "Branch:") . $refname,
@notice,
($action ne "removed" and $gitweb_url)
- ? "URL: $gitweb_url/?a=shortlog;h=$ref" : undef),
+ ? "URL: ${gitweb_url}a=shortlog;h=$ref" : undef),
"",
"The $refname $reftype has been $action.");
close REVPARSE or die $! ? "Cannot execute rev-parse: $!" : "rev-parse exited with status: $?";
}
$obj_string = $obj if not defined $obj_string;
- $url = "$gitweb_url/?a=$info{type};h=$obj_string";
+ $url = "${gitweb_url}a=$info{type};h=$obj_string";
}
if ($info{"type"} eq "tag")
}
else
{
- push @notice, "Diff: $gitweb_url/?a=commitdiff;h=$obj_string" if $gitweb_url;
+ push @notice, "Diff: ${gitweb_url}a=commitdiff;h=$obj_string" if $gitweb_url;
}
$subject = $info{"author_name"} . ": " unless $omit_author;
}
push @cia_text,
" </files>",
- $gitweb_url ? " <url>" . xml_escape("$gitweb_url/?a=commit;h=$commit") . "</url>" : "",
+ $gitweb_url ? " <url>" . xml_escape("${gitweb_url}a=commit;h=$commit") . "</url>" : "",
" </commit>",
" </body>",
" <timestamp>" . $info{"author_date"} . "</timestamp>",
foreach my $rev (@$notice)
{
- $rev =~ s/^commit /URL: $gitweb_url\/?a=commit;h=/ if $gitweb_url;
+ $rev =~ s/^commit /URL: ${gitweb_url}a=commit;h=/ if $gitweb_url;
}
mail_notification($commitlist_address, "New commits on branch $ref", "text/plain; charset=UTF-8", @$notice);
umask( $mode_mask );
# append repository path to URL
-$gitweb_url .= "/$repos_name.git" if $gitweb_url;
+if ($gitweb_url) {
+ $gitweb_url .= $sourceforge ? "/$repos_name;" : "/$repos_name.git/?";
+}
if (@ARGV)
{