Created
April 21, 2019 09:38
-
-
Save sidcha/c1d2fce0bd5ef31115c59fc953f00f2f to your computer and use it in GitHub Desktop.
Splits or dissects large patch file into smaller per-file-change patches. Comes in handy when patches don't apply anymore.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
while (<>) { | |
if(/^diff --git a\/(\S+)/) { | |
close $f if $f; | |
$s=$1; | |
$s =~ s:(/|\.):_:g; | |
$n=sprintf("%03d_%s.patch", ++$i, $s); | |
open $f, ">", $n; | |
print $f $_; | |
next; | |
} | |
print $f $_ if $f; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment