diff --git a/quilt/scripts/patchfns.in b/quilt/scripts/patchfns.in index c9923e3..196d26d 100644 --- a/quilt/scripts/patchfns.in +++ b/quilt/scripts/patchfns.in @@ -841,9 +841,32 @@ cat_to_new_file() patch_header() { awk ' - /^(---|\*\*\*|Index:)[ \t][^ \t]|^diff -/ \ - { exit } - { print } + !(MAYBE_CONTEXT || MAYBE_UNIFIED) { + if (/^\*\*\*[ \t][^ \t]/) { + eaten=$0 + MAYBE_CONTEXT=1 + next + } + if (/^---[ \t][^ \t]/) { + eaten=$0 + MAYBE_UNIFIED=1 + next + } + } + MAYBE_CONTEXT { + if (/^---[ \t][^ \t]/) + exit + print eaten + MAYBE_CONTEXT=0 + } + MAYBE_UNIFIED { + if (/^+++[ \t][^ \t]/) + exit + print eaten + MAYBE_UNIFIED=0 + } + /^Index:[ \t][^ \t]/ { exit } + { print } ' }