mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-26 16:56:28 +01:00
Merge pull request #160 from tateisu/fix/CheckScript
mainブランチだとpre-commitチェックで止まるようにする
This commit is contained in:
commit
f069059493
@ -6,6 +6,7 @@ use File::Find;
|
||||
use XML::Simple;
|
||||
use Data::Dump qw(dump);
|
||||
use utf8;
|
||||
use feature qw(say);
|
||||
|
||||
binmode $_ for \*STDOUT,\*STDERR;
|
||||
|
||||
@ -30,6 +31,7 @@ open(my $fh,"-|","git status --porcelain --branch")
|
||||
or die "can't check git status. $!";
|
||||
|
||||
my @untrackedFiles;
|
||||
my $branch;
|
||||
while(<$fh>){
|
||||
s/[\x0d\x0a]+//;
|
||||
if(/^\?\?\s*(\S+)/){
|
||||
@ -37,12 +39,7 @@ while(<$fh>){
|
||||
next if $path =~ /\.idea|_Emoji/;
|
||||
push @untrackedFiles,$path
|
||||
}elsif( /^##\s*(\S+?)(?:\.\.|$)/ ){
|
||||
my $branch=$1;
|
||||
print "# branch=$branch\n";
|
||||
if($preCommit){
|
||||
# mainブランチに直接コミットすることはなくなった
|
||||
$branch eq 'main' and warn "!!!! current branch is main. Direct commits and pushes are prohibited. !!!!\n";
|
||||
}
|
||||
$branch=$1;
|
||||
# }else{
|
||||
# warn "working tree is not clean.\n";
|
||||
# cmd "git status";
|
||||
@ -154,6 +151,13 @@ print "(total)string resource count=$nameCount\n";
|
||||
|
||||
$hasError and die "please fix error(s).\n";
|
||||
|
||||
# ブランチがmainなら直接コミットさせない
|
||||
print "# branch=$branch\n";
|
||||
if($preCommit){
|
||||
# mainブランチに直接コミットすることはなくなった
|
||||
$branch eq 'main' and die "!!!! current branch is main. Direct commits and pushes are prohibited. !!!!\n";
|
||||
}
|
||||
|
||||
# Weblateの未マージのブランチがあるか調べる
|
||||
system qq(git fetch weblate -q);
|
||||
my @list = `git branch -r --no-merged`;
|
||||
|
Loading…
Reference in New Issue
Block a user