summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/git-notify29
-rwxr-xr-xtools/git-post-receive-hook1
2 files changed, 8 insertions, 22 deletions
diff --git a/tools/git-notify b/tools/git-notify
index d852823..17093aa 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -18,7 +18,6 @@
18# -A Omit the author name from the mail subject 18# -A Omit the author name from the mail subject
19# -C Show committer in the body if different from the author 19# -C Show committer in the body if different from the author
20# -c name Send CIA notifications under specified project name 20# -c name Send CIA notifications under specified project name
21# -H The mail(1) utility doesn't accept headers via "-a"
22# -m addr Send mail notifications to specified address 21# -m addr Send mail notifications to specified address
23# -n max Set max number of individual mails to send 22# -n max Set max number of individual mails to send
24# -r name Set the git repository name 23# -r name Set the git repository name
@@ -44,8 +43,8 @@ sub get_repos_name();
44 43
45# some parameters you may want to change 44# some parameters you may want to change
46 45
47# set this to something that takes "-s" 46# sendmail's pathname
48my $mailer = "/usr/bin/mail"; 47my $sendmail = "/usr/sbin/sendmail";
49 48
50# CIA notification address 49# CIA notification address
51my $cia_address = "cia\@cia.vc"; 50my $cia_address = "cia\@cia.vc";
@@ -55,9 +54,6 @@ my $debug = 0;
55 54
56# configuration parameters 55# configuration parameters
57 56
58# the $mailer doesn't accept headers via "-a" (can be set with the -H option)
59my $legacy_mail = git_config( "notify.legacymail" );
60
61# omit the author from the mail subject (can be set with the -A option) 57# omit the author from the mail subject (can be set with the -A option)
62my $omit_author = git_config( "notify.omitauthor" ); 58my $omit_author = git_config( "notify.omitauthor" );
63 59
@@ -112,7 +108,6 @@ sub usage()
112 print " -A Omit the author name from the mail subject\n"; 108 print " -A Omit the author name from the mail subject\n";
113 print " -C Show committer in the body if different from the author\n"; 109 print " -C Show committer in the body if different from the author\n";
114 print " -c name Send CIA notifications under specified project name\n"; 110 print " -c name Send CIA notifications under specified project name\n";
115 print " -H The mail(1) utility doesn't accept headers via `-a'\n";
116 print " -m addr Send mail notifications to specified address\n"; 111 print " -m addr Send mail notifications to specified address\n";
117 print " -n max Set max number of individual mails to send\n"; 112 print " -n max Set max number of individual mails to send\n";
118 print " -r name Set the git repository name\n"; 113 print " -r name Set the git repository name\n";
@@ -301,7 +296,6 @@ sub parse_options()
301 elsif ($arg eq '-A') { $omit_author = 1; } 296 elsif ($arg eq '-A') { $omit_author = 1; }
302 elsif ($arg eq '-C') { $show_committer = 1; } 297 elsif ($arg eq '-C') { $show_committer = 1; }
303 elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; } 298 elsif ($arg eq '-c') { $cia_project_name = shift @ARGV; }
304 elsif ($arg eq '-H') { $legacy_mail = 1; }
305 elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; } 299 elsif ($arg eq '-m') { $commitlist_address = shift @ARGV; }
306 elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; } 300 elsif ($arg eq '-n') { $max_individual_notices = shift @ARGV; }
307 elsif ($arg eq '-r') { $repos_name = shift @ARGV; } 301 elsif ($arg eq '-r') { $repos_name = shift @ARGV; }
@@ -330,14 +324,13 @@ sub mail_notification($$$@)
330 $subject = "[$repos_name] $subject" if ($emit_repo and $name ne $cia_address); 324 $subject = "[$repos_name] $subject" if ($emit_repo and $name ne $cia_address);
331 $subject = encode("MIME-Q",$subject); 325 $subject = encode("MIME-Q",$subject);
332 326
327 my @header = ("To: $name", "Subject: $subject", "Content-Type: $content_type");
328
333 if ($debug) 329 if ($debug)
334 { 330 {
335 binmode STDOUT, ":utf8"; 331 binmode STDOUT, ":utf8";
336 print "---------------------\n"; 332 print "---------------------\n";
337 print "To: $name\n"; 333 print join("\n", @header), "\n\n", join("\n", @text), "\n";
338 print "Subject: $subject\n";
339 print "Content-Type: $content_type\n";
340 print "\n", join("\n", @text), "\n";
341 } 334 }
342 else 335 else
343 { 336 {
@@ -345,17 +338,11 @@ sub mail_notification($$$@)
345 return unless defined $pid; 338 return unless defined $pid;
346 if (!$pid) 339 if (!$pid)
347 { 340 {
348 my @mailer_options = ( "-s", $subject ); 341 exec $sendmail, "-t", "-oi", "-oem" or die "Cannot exec $sendmail";
349
350 unless ($legacy_mail)
351 {
352 push @mailer_options, "-a", "Content-Type: $content_type";
353 }
354 exec $mailer, @mailer_options, $name or die "Cannot exec $mailer";
355 } 342 }
356 binmode MAIL, ":utf8"; 343 binmode MAIL, ":utf8";
357 print MAIL join("\n", @text), "\n"; 344 print MAIL join("\n", @header), "\n\n", join("\n", @text), "\n";
358 close MAIL or warn $! ? "Cannot execute $mailer: $!" : "$mailer exited with status: $?"; 345 close MAIL or warn $! ? "Cannot execute $sendmail: $!" : "$sendmail exited with status: $?";
359 } 346 }
360} 347}
361 348
diff --git a/tools/git-post-receive-hook b/tools/git-post-receive-hook
index fd1f869..db9ad9e 100755
--- a/tools/git-post-receive-hook
+++ b/tools/git-post-receive-hook
@@ -18,7 +18,6 @@ exec "$gitnotify" \
18 -u "$gitweburl" \ 18 -u "$gitweburl" \
19 -A \ 19 -A \
20 -C \ 20 -C \
21 -H \
22 -S \ 21 -S \
23 -T \ 22 -T \
24 -X \ 23 -X \