X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin%2Fapply.c;h=530d4bb7e76da8e402f78ab7f981a080d25d6e78;hb=a8793d2178b8305be55b1c88ac13fbb7dc52a076;hp=36e150768ba88e427e6257900d7ec4c67c8303c1;hpb=af4c62ae88d403a417ba7c2b879eca10e7bff8f4;p=git.git diff --git a/builtin/apply.c b/builtin/apply.c index 36e150768..530d4bb7e 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -43,6 +43,7 @@ static int apply = 1; static int apply_in_reverse; static int apply_with_reject; static int apply_verbosely; +static int allow_overlap; static int no_add; static const char *fake_ancestor; static int line_termination = '\n'; @@ -2430,9 +2431,9 @@ static void update_image(struct image *img, memcpy(img->line + applied_pos, postimage->line, postimage->nr * sizeof(*img->line)); - for (i = 0; i < postimage->nr; i++) - img->line[applied_pos + i].flag |= LINE_PATCHED; - + if (!allow_overlap) + for (i = 0; i < postimage->nr; i++) + img->line[applied_pos + i].flag |= LINE_PATCHED; img->nr = nr; } @@ -3889,6 +3890,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_) "don't expect at least one line of context"), OPT_BOOLEAN(0, "reject", &apply_with_reject, "leave the rejected hunks in corresponding *.rej files"), + OPT_BOOLEAN(0, "allow-overlap", &allow_overlap, + "allow overlapping hunks"), OPT__VERBOSE(&apply_verbosely, "be verbose"), OPT_BIT(0, "inaccurate-eof", &options, "tolerate incorrectly detected missing new-line at the end of file",