+sub reject_commit($)
+{
+ # reject == merge but skip
+ my ($r) = @_;
+ my $cmsg = "";
+ my $author = "";
+ my $email = "";
+ my $date = "";
+ if($do_commit)
+ {
+ $logcache = undef;
+ my $msg = backtick 'git', 'log', '-1', '--pretty=fuller', $r
+ or die "git-log: $!";
+ for(split /\n/, $msg)
+ {
+ if(/^Author:\s*(.*) <(.*)>/)
+ {
+ $author = $1;
+ $email = $2;
+ }
+ elsif(/^AuthorDate:\s*(.*)/)
+ {
+ $date = $1;
+ }
+ elsif(/^ (.*)/)
+ {
+ $cmsg .= "$1\n";
+ }
+ }
+ open my $fh, '>', '.commitmsg'
+ or die ">.commitmsg: $!";
+ print $fh "REJECT\n$cmsg" . "::stable-branch::reject=$r\n"
+ or die ">.commitmsg: $!";
+ close $fh
+ or die ">.commitmsg: $!";
+ }
+ local $ENV{GIT_AUTHOR_NAME} = $author;
+ local $ENV{GIT_AUTHOR_EMAIL} = $email;
+ local $ENV{GIT_AUTHOR_DATE} = $date;
+ if($do_commit)
+ {
+ run 'git', 'commit', '--allow-empty', '-F', '.commitmsg'
+ or die "git-commit: $!";
+ }
+}
+
+sub unreject_commit($)
+{
+ # reject == merge but skip
+ my ($r) = @_;
+ my $cmsg = "";
+ my $author = "";
+ my $email = "";
+ my $date = "";
+ if($do_commit)
+ {
+ $logcache = undef;
+ my $msg = backtick 'git', 'log', '-1', '--pretty=fuller', $r
+ or die "git-log: $!";
+ for(split /\n/, $msg)
+ {
+ if(/^Author:\s*(.*) <(.*)>/)
+ {
+ $author = $1;
+ $email = $2;
+ }
+ elsif(/^AuthorDate:\s*(.*)/)
+ {
+ $date = $1;
+ }
+ elsif(/^ (.*)/)
+ {
+ $cmsg .= "$1\n";
+ }
+ }
+ open my $fh, '>', '.commitmsg'
+ or die ">.commitmsg: $!";
+ print $fh "UNREJECT\n$cmsg" . "::stable-branch::unreject=$r\n"
+ or die ">.commitmsg: $!";
+ close $fh
+ or die ">.commitmsg: $!";
+ }
+ local $ENV{GIT_AUTHOR_NAME} = $author;
+ local $ENV{GIT_AUTHOR_EMAIL} = $email;
+ local $ENV{GIT_AUTHOR_DATE} = $date;
+ if($do_commit)
+ {
+ run 'git', 'commit', '--allow-empty', '-F', '.commitmsg'
+ or die "git-commit: $!";
+ }
+}
+