2011-07-08 22:34:06 +00:00
|
|
|
#!/usr/bin/perl
|
2011-07-01 19:35:38 +00:00
|
|
|
|
2011-07-08 22:34:06 +00:00
|
|
|
use strict;
|
|
|
|
use FindBin qw($Bin);
|
|
|
|
|
|
|
|
my $hook_file = "$Bin/../.git/hooks/commit-msg";
|
|
|
|
|
|
|
|
unless (-e $hook_file) {
|
|
|
|
print <<EOF;
|
2011-07-01 19:35:38 +00:00
|
|
|
Presubmit hook to add Change-Id to commit messages is missing.
|
2011-07-08 22:34:06 +00:00
|
|
|
Copying to $hook_file.
|
2011-07-01 19:35:38 +00:00
|
|
|
EOF
|
|
|
|
|
2011-07-08 22:34:06 +00:00
|
|
|
system("cp", "-p", "$Bin/commit-msg.githook", $hook_file) and die "cp failed.\n";
|
|
|
|
|
|
|
|
print <<EOF;
|
2011-07-01 19:35:38 +00:00
|
|
|
Amending last commit to add Change-Id.
|
|
|
|
Please re-save description without making changes.
|
|
|
|
|
|
|
|
Press Enter to continue.
|
|
|
|
EOF
|
2011-06-13 21:24:51 +00:00
|
|
|
|
2011-07-08 22:34:06 +00:00
|
|
|
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");
|