From 4334022df38cbf71c96fe45655092211b5207dd6 Mon Sep 17 00:00:00 2001 From: lxoliva Date: Wed, 23 Jul 2008 05:47:25 +0000 Subject: [PATCH] Introduce --reverse-patch. git-svn-id: http://www.fsfla.org/svn/fsfla/software/linux-libre/scripts@3997 559672b5-ba27-0410-b829-e8f1faed8b1b --- deblob-check | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/deblob-check b/deblob-check index 8c5e97fafd1..6028e78fe13 100755 --- a/deblob-check +++ b/deblob-check @@ -38,6 +38,9 @@ # Specifies the number of consecutive integral or # character constants that trigger the blob detector. +# --reverse-patch: Test the removed parts of a patch, rather than +# the added ones. + # The default sensitivity is 32 constants. # The sensitivity, if present, must be the first option. The action @@ -250,6 +253,14 @@ case $1 in ;; esac +reverse_patch=false +case $1 in +--reverse-patch) + reverse_patch=: + shift; + ;; +esac + test_mode=false name=deblob-check @@ -1930,17 +1941,22 @@ check () { cmd="tar -xf - --to-command='echo \";/*begin \$TAR_FILENAME*/;\"; cat; echo \";/**/;\"; echo \";/*end \$TAR_FILENAME*/;\"'" ;; *.patch | */patch-* | *.diff) - sedpatch=' - /^[-]/d; - /^\(@@\|+++\) / { - i\ -;/**/;\ -;/*end patchlet */;\ + if $reverse_patch; then + s=- r=+ + else + s=+ r=- + fi + sedpatch=" + /^[$r]/d; + /^\\(@@\\|$s$s$s\\) / { + i\\ +;/**/;\\ +;/*end patchlet */;\\ ;/*begin patchlet */; - s/^/;\/*/; - s/$/*\/;/; + s/^/;\\/*/; + s/\$/*\\/;/; }; - s/^[ +]//;' + s/^[ $s]//;" cmd='sed "$sedpatch"' ;; *) -- 2.31.1