
On Sun, 2012-06-10 at 13:45 +1000, Russell Coker wrote:
I have to deal with some very long patches that have many sections that are of interest. What I need is a tool that allows basic regular expressions to search and which then gets every file that matches. IE if a patch changed files a.c, b.c, and c.c and I did a search for printf then I would want patches for the files which have changes related to printf and have the changes include all sections for each file in question.
Failing that does anyone know of a tool to split a large patch into one separate patch for each file that is patched? EG a patch would be split into a.c.diff, b.c.diff, and c.c.diff? Once a patch was split like that I could use some shell code that involves grep and rm to get the patches I really want.
csplit the-patch-file '/^--- /' '{*}' should split up the patches for you, leaving an empty xx00 and the patches in xx* thereafter. You may want to further tighten the pattern though.