From 8c2aa6161a2435f2af7e7df3a36125e85af0f0ec Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Mon, 9 Oct 2017 17:40:04 +0200
Subject: [PATCH] git2spec.pl: handle empty merge commits
---
git2spec.pl | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/git2spec.pl b/git2spec.pl
index 0c5f3b9e..7853791e 100755
--- a/git2spec.pl
+++ b/git2spec.pl
@@ -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;
}