]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
git2spec.pl: handle empty merge commits
authorHarald Hoyer <harald@redhat.com>
Mon, 9 Oct 2017 15:40:04 +0000 (17:40 +0200)
committerHarald Hoyer <harald@redhat.com>
Mon, 9 Oct 2017 15:40:04 +0000 (17:40 +0200)
git2spec.pl

index 0c5f3b9e43111852ac04454a309c2fb4bb03ac07..7853791e715a3e833a600acc05918bd0c11d6476 100755 (executable)
@@ -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;
     }