tleleu / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
e336be
#!/usr/bin/perl -w
e336be
# A script to remove those terrible binary diffs from the patches which
e336be
# screw up everything and rain on my parade.
e336be
e336be
use strict;
e336be
e336be
my @args=@ARGV;
e336be
my @current_patch;
e336be
my $is_binary = 0;
e336be
my $cnt = 0;
e336be
e336be
while(my $row = <>) {
e336be
	# diff marks the start of a new file to check
e336be
	if ($row =~ /^diff --git.*?(\S+)$/) {
e336be
		if (!$is_binary) {
e336be
			foreach my $line (@current_patch) {
e336be
				print $line;
e336be
			}
e336be
		}
e336be
		$is_binary = 0;
e336be
		@current_patch = ();
e336be
	} elsif ($row =~ /Binary files (.)* differ$/) {
e336be
		$is_binary = 1;
e336be
	} elsif ($row =~ /GIT binary patch/) {
e336be
		$is_binary = 1;
e336be
	}
e336be
	push (@current_patch, $row);
e336be
}
e336be
e336be
if (!$is_binary) {
e336be
	foreach my $line (@current_patch) {
e336be
		print $line;
e336be
	}
e336be
}