Harald Hoyer afa7aa
From 8c2aa6161a2435f2af7e7df3a36125e85af0f0ec Mon Sep 17 00:00:00 2001
Harald Hoyer afa7aa
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer afa7aa
Date: Mon, 9 Oct 2017 17:40:04 +0200
Harald Hoyer afa7aa
Subject: [PATCH] git2spec.pl: handle empty merge commits
Harald Hoyer afa7aa
Harald Hoyer afa7aa
---
Harald Hoyer afa7aa
 git2spec.pl | 10 ++++++++--
Harald Hoyer afa7aa
 1 file changed, 8 insertions(+), 2 deletions(-)
Harald Hoyer afa7aa
Harald Hoyer afa7aa
diff --git a/git2spec.pl b/git2spec.pl
Harald Hoyer afa7aa
index 0c5f3b9e..7853791e 100755
Harald Hoyer afa7aa
--- a/git2spec.pl
Harald Hoyer afa7aa
+++ b/git2spec.pl
Harald Hoyer afa7aa
@@ -5,6 +5,8 @@ sub create_patches {
Harald Hoyer afa7aa
     my $pdir=shift;
Harald Hoyer afa7aa
     my $n=1;
Harald Hoyer afa7aa
     my @lines;
Harald Hoyer afa7aa
+    my $fname;
Harald Hoyer afa7aa
+    my $f=0;
Harald Hoyer afa7aa
 
Harald Hoyer afa7aa
     mkdir $pdir, 0755;
Harald Hoyer afa7aa
 
Harald Hoyer afa7aa
@@ -12,9 +14,13 @@ sub create_patches {
Harald Hoyer afa7aa
 
Harald Hoyer afa7aa
     while (<GIT>) {
Harald Hoyer afa7aa
         if (/^From [a-z0-9]{40} .*$/) {
Harald Hoyer afa7aa
-            my $fname = sprintf("%04d", $n++).".patch";
Harald Hoyer afa7aa
-            push @lines, $fname;
Harald Hoyer afa7aa
+            $fname = sprintf("%04d", $n++).".patch";
Harald Hoyer afa7aa
             open FH, ">".$pdir."/".$fname;
Harald Hoyer afa7aa
+            $f=1;
Harald Hoyer afa7aa
+        }
Harald Hoyer afa7aa
+        if (/^---$/ && $f == 1) {
Harald Hoyer afa7aa
+            push @lines, $fname;
Harald Hoyer afa7aa
+            $f=0;
Harald Hoyer afa7aa
         }
Harald Hoyer afa7aa
         print FH;
Harald Hoyer afa7aa
     }
Harald Hoyer afa7aa