Third-Party Tools for Working with Patches
Once you’ve been working with patches for a while, you’ll find yourself hungry for tools that will help you to understand and manipulate the patches you’re dealing with.
The diffstat
command generates a histogram of the modifications made to each
file in a patch. It provides a good way to “get a sense of” a
patch—which files it affects, and how much change it introduces to each
file and as a whole. (I find that it’s a good idea to use
diffstat’s -p
option as a matter of course, as
otherwise it will try to do clever things with prefixes of filenames
that inevitably confuse at least me.)
$
diffstat -p1 remove-redundant-null-checks.patch
drivers/char/agp/sgi-agp.c | 5 ++--- drivers/char/hvcs.c | 11 +++++------ drivers/message/fusion/mptfc.c | 6 ++---- drivers/message/fusion/mptsas.c | 3 +-- drivers/net/fs_enet/fs_enet-mii.c | 3 +-- drivers/net/wireless/ipw2200.c | 22 ++++++---------------- drivers/scsi/libata-scsi.c | 4 +--- drivers/video/au1100fb.c | 3 +-- 8 files changed, 19 insertions(+), 38 deletions(-)$
filterdiff -i '*/video/*' remove-redundant-null-checks.patch
--- a/drivers/video/au1100fb.c~remove-redundant-null-checks-before-free-in-drivers +++ a/drivers/video/au1100fb.c @@ -743,8 +743,7 @@ void __exit au1100fb_cleanup(void) { driver_unregister(&au1100fb_driver); - if (drv_info.opt_mode) - kfree(drv_info.opt_mode); + kfree(drv_info.opt_mode); } module_init(au1100fb_init);
The patchutils
package is
invaluable. It provides a set of small ...
Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.