git2spec.pl: handle empty merge commits

master
Harald Hoyer 2017-10-09 17:40:04 +02:00
parent 4c2d98c75b
commit 8c2aa6161a
1 changed files with 8 additions and 2 deletions

View File

@ -5,6 +5,8 @@ sub create_patches {
my $pdir=shift;
my $n=1;
my @lines;
my $fname;
my $f=0;

mkdir $pdir, 0755;

@ -12,9 +14,13 @@ sub create_patches {

while (<GIT>) {
if (/^From [a-z0-9]{40} .*$/) {
my $fname = sprintf("%04d", $n++).".patch";
push @lines, $fname;
$fname = sprintf("%04d", $n++).".patch";
open FH, ">".$pdir."/".$fname;
$f=1;
}
if (/^---$/ && $f == 1) {
push @lines, $fname;
$f=0;
}
print FH;
}