+sub update_tag($$$$$)
+{
+ my ($tag, $old, $new, $out, $headers) = @_;
+
+ my $subj = '[' . $subject_prefix . ']';
+ if ($new =~ /^0+$/) {
+ $subj .= " Deleted tag $tag";
+ print $out "Deleted tag $tag ($old).\n";
+ } else {
+ my $copy_of = scan_branches(undef, $new);
+ my $cp = defined($copy_of) ? " to branch $copy_of" : "";
+ if ($old =~ /^0+/) {
+ $subj .= " Created tag $tag$cp";
+ print $out "Created tag $tag$cp ($new).\n\n";
+ } else {
+ $subj .= " Changed tag $tag$cp";
+ print $out "Changed tag $tag$cp ($old -> $new).\n\n";
+ }
+ most_recent($new);
+ }
+
+ $headers->{'Subject'} = $subj;
+ $headers->{'X-Git-Tag'} = $tag;
+ return 1;
+}
+