perkeep/misc/review

29 lines
651 B
Perl
Executable File

#!/usr/bin/perl
use strict;
use FindBin qw($Bin);
my $hook_file = "$Bin/../.git/hooks/commit-msg";
unless (-e $hook_file) {
print <<EOF;
Presubmit hook to add Change-Id to commit messages is missing.
Copying to $hook_file.
EOF
system("cp", "-p", "$Bin/commit-msg.githook", $hook_file) and die "cp failed.\n";
print <<EOF;
Amending last commit to add Change-Id.
Please re-save description without making changes.
Press Enter to continue.
EOF
scalar(<STDIN>);
system("git", "commit", "--amend") and die "git commit --amend fail\n";
}
exec("git", "push", "ssh://$ENV{USER}\@camlistore.org:29418/camlistore", "HEAD:refs/for/master");