summaryrefslogtreecommitdiffstats
path: root/remove-binary-diff.pl
diff options
context:
space:
mode:
authorLaura Abbott <labbott@fedoraproject.org>2016-12-15 15:35:40 -0800
committerLaura Abbott <labbott@fedoraproject.org>2016-12-15 15:35:40 -0800
commit68eebd5c343394f45361e9e3732cfbb8a3e32e32 (patch)
tree5c2ba83f864fd69c4e7620c6983b8814b11a919d /remove-binary-diff.pl
parent5de569a890be505e0ec46d2b1c9691f0405a17c6 (diff)
downloadkernel-68eebd5c343394f45361e9e3732cfbb8a3e32e32.tar.gz
kernel-68eebd5c343394f45361e9e3732cfbb8a3e32e32.tar.xz
kernel-68eebd5c343394f45361e9e3732cfbb8a3e32e32.zip
Linux v4.9 rebase
Diffstat (limited to 'remove-binary-diff.pl')
-rwxr-xr-xremove-binary-diff.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/remove-binary-diff.pl b/remove-binary-diff.pl
new file mode 100755
index 000000000..9048490ca
--- /dev/null
+++ b/remove-binary-diff.pl
@@ -0,0 +1,34 @@
+#!/usr/bin/perl -w
+# A script to remove those terrible binary diffs from the patches which
+# screw up everything and rain on my parade.
+
+use strict;
+
+my @args=@ARGV;
+my @current_patch;
+my $is_binary = 0;
+my $cnt = 0;
+
+while(my $row = <>) {
+ # diff marks the start of a new file to check
+ if ($row =~ /^diff --git.*?(\S+)$/) {
+ if (!$is_binary) {
+ foreach my $line (@current_patch) {
+ print $line;
+ }
+ }
+ $is_binary = 0;
+ @current_patch = ();
+ } elsif ($row =~ /Binary files (.)* differ$/) {
+ $is_binary = 1;
+ } elsif ($row =~ /GIT binary patch/) {
+ $is_binary = 1;
+ }
+ push (@current_patch, $row);
+}
+
+if (!$is_binary) {
+ foreach my $line (@current_patch) {
+ print $line;
+ }
+}