Alexandre Julliard : patches: Insert a blank line before the git signature.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Feb 25 06:33:41 CST 2015


Module: tools
Branch: master
Commit: 06f795c5b0ed1a0b399a1cf03e779081c0cbef30
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=06f795c5b0ed1a0b399a1cf03e779081c0cbef30

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Feb  4 21:18:16 2015 +0900

patches: Insert a blank line before the git signature.

This avoids making it look like a corrupted diff.

---

 patches/filter | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/patches/filter b/patches/filter
index 306787d..53ea86e 100755
--- a/patches/filter
+++ b/patches/filter
@@ -61,24 +61,23 @@ sub filter_patch(@)
     my @diff_lines = ();
     my $p_option = -1;
     my $use_index = 0;
+    my $git_patch = 0;
 
     foreach $_ (@_)
     {
         chomp;
         s/\r$//;
         if (/^Index: (\S*)/) { $use_index = 1; }
-        elsif (/^\+\+\+ b\//) { $p_option = 1; }
-        elsif (/^diff --git/) { $p_option = 1; }
+        elsif (/^\+\+\+ b\//) { $git_patch = 1; }
+        elsif (/^diff --git/) { $git_patch = 1; }
         elsif (/ (\/dev\/null)/) { push @diff_lines, $1; }
         elsif (/^--- (\S*)\//) { push @diff_lines, $1; }
         elsif (/^\+\+\+ (\S*)\//) { push @diff_lines, $1; }
     }
 
-    if ($p_option == -1)
-    {
-        if ($use_index) { $p_option = 0; }
-        else { $p_option = find_p_option( @diff_lines ); }
-    }
+    if ($git_patch) { $p_option = 1; }
+    elsif ($use_index) { $p_option = 0; }
+    else { $p_option = find_p_option( @diff_lines ); }
 
     # now patch the diff lines
     my $file = "";
@@ -107,6 +106,10 @@ sub filter_patch(@)
             $f = add_prefix( $file, $p_option, "b/" );
             s/^\+\+\+ .*/\+\+\+ $f/;
         }
+        elsif ($git_patch && /^-- $/)
+        {
+            $_ = "\n" . $_;
+        }
     }
 
     return @_;




More information about the wine-cvs mailing list