aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-16 16:36:46 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-16 16:36:46 -0700
commitc69e8b693591bc35e8f9421eacb9d59c71807304 (patch)
treefef8fdcbd924820c5b25e2671be2d92219de23aa /builtin
parent43d532e6ba3450a84cad007062b8ac429d7a8ac3 (diff)
parent0bf9fc0cd28bf8e983a5280676fcaeb826403516 (diff)
downloadgit-c69e8b693591bc35e8f9421eacb9d59c71807304.tar.gz
git-c69e8b693591bc35e8f9421eacb9d59c71807304.tar.xz
Merge branch 'jc/maint-add-p-overlapping-hunks' into maint
* jc/maint-add-p-overlapping-hunks: t3701: add-p-fix makes the last test to pass "add -p": work-around an old laziness that does not coalesce hunks add--interactive.perl: factor out repeated --recount option t3701: Editing a split hunk in an "add -p" session add -p: 'q' should really quit
Diffstat (limited to 'builtin')
-rw-r--r--builtin/apply.c9
1 files changed, 6 insertions, 3 deletions
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",