Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-12-17 00:08:47 +0300
committerJunio C Hamano <gitster@pobox.com>2019-12-17 00:08:47 +0300
commit011fc2e88e9ab13760c571330737ffaf0986e4ef (patch)
treed3a9036fdd1c30284ca1bd6829dfdeef9201b093 /apply.c
parentd1c0fe8d9b16bf8b6b1cc0e83fac6670e3f64f0f (diff)
parentb4bbbbd5a247e0e75d079bca591b657ec9084a46 (diff)
Merge branch 'js/add-i-a-bit-more-tests'
Test coverage update in preparation for further work on "git add -i". * js/add-i-a-bit-more-tests: apply --allow-overlap: fix a corner case git add -p: use non-zero exit code when the diff generation failed t3701: verify that the diff.algorithm config setting is handled t3701: verify the shown messages when nothing can be added t3701: add a test for the different `add -p` prompts t3701: avoid depending on the TTY prerequisite t3701: add a test for advanced split-hunk editing
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apply.c b/apply.c
index b5485ef6c9..fab44322c5 100644
--- a/apply.c
+++ b/apply.c
@@ -2662,6 +2662,16 @@ static int find_pos(struct apply_state *state,
int backwards_lno, forwards_lno, current_lno;
/*
+ * When running with --allow-overlap, it is possible that a hunk is
+ * seen that pretends to start at the beginning (but no longer does),
+ * and that *still* needs to match the end. So trust `match_end` more
+ * than `match_beginning`.
+ */
+ if (state->allow_overlap && match_beginning && match_end &&
+ img->nr - preimage->nr != 0)
+ match_beginning = 0;
+
+ /*
* If match_beginning or match_end is specified, there is no
* point starting from a wrong line that will never match and
* wander around and wait for a match at the specified end.