Generating patches without cleaning code

Instead of generating a patch from two pristine copies of the code (one with your changes and both not compiled), it is useful to create a exclude-list of all the files that you want to ignore.

 .*
 *.lds
 *.o
 *.o.*
 *.a
 *.s
 *.ko
 *.so
 *.so.dbg
 *.mod.c
 *.i
 *.lst
 *.symtypes
 *.order
 *.elf
 *.bin
 *.gz
 *.lzma
 *.patch
 *.gcno
 tags
 TAGS
 bzImage
 vmlinux
 System.map
 Module.markers
 Module.symvers
 !.gitignore
 !.mailmap
 patches-*
 patches
 series
 exclude-list
 filefortag
 filelist
 cscope.*
 ncscope.*
 GPATH
 GRTAGS
 GSYMS
 GTAGS
 *.orig
 *~


Then create the patch

diff --exclude-from /path/to/exclude-list -urNd linux-2.6.24-hunterwala linux-2.6.24 > patch_file

Each line in exclude-list is a pattern which diff would match and ignore the files. I am having trouble excluding following directories.

include/asm
include/asm-*/asm-offsets.h
include/config
include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h
include/linux/utsrelease.h
include/linux/bounds.h
include/generated


So, the -N passed to diff would treat these as new files and include them in the patch. :(

TODO: Update post once I find a better way to handle directories.

[The exclude list above has been taken from .gitignore]

No comments: