diff options
author | Jerry Zhang <jerry@skydio.com> | 2021-04-06 16:25:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-06 17:11:41 -0700 |
commit | 923cd87ac8550a8e277bfeb19198a11b6a8ed854 (patch) | |
tree | c52acf27d606da3c6e8dee0e9bafd010c5986c78 /Documentation/git-apply.txt | |
parent | 2e36527f23b7f6ae15e6f21ac3b08bf3fed6ee48 (diff) | |
download | git-923cd87ac8550a8e277bfeb19198a11b6a8ed854.tar.gz |
git-apply: try threeway first when "--3way" is used
The apply_fragments() method of "git apply"
can silently apply patches incorrectly if
a file has repeating contents. In these
cases a three-way merge is capable of applying
it correctly in more situations, and will
show a conflict rather than applying it
incorrectly. However, because the patches
apply "successfully" using apply_fragments(),
git will never fall back to the merge, even
if the "--3way" flag is used, and the user has
no way to ensure correctness by forcing the
three-way merge method.
Change the behavior so that when "--3way" is used,
git will always try the three-way merge first and
will only fall back to apply_fragments() in cases
where blobs are not available or some other error
(but not in the case of a merge conflict).
Since user-facing results will be different,
this has backwards compatibility implications
for users depending on the old behavior. In
addition, the three-way merge will be slower
than direct patch application.
Signed-off-by: Jerry Zhang <jerry@skydio.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-apply.txt')
-rw-r--r-- | Documentation/git-apply.txt | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Documentation/git-apply.txt b/Documentation/git-apply.txt index 91d9a8601c..9144575299 100644 --- a/Documentation/git-apply.txt +++ b/Documentation/git-apply.txt @@ -84,9 +84,8 @@ OPTIONS -3:: --3way:: - When the patch does not apply cleanly, fall back on 3-way merge if - the patch records the identity of blobs it is supposed to apply to, - and we have those blobs available locally, possibly leaving the + Attempt 3-way merge if the patch records the identity of blobs it is supposed + to apply to and we have those blobs available locally, possibly leaving the conflict markers in the files in the working tree for the user to resolve. This option implies the `--index` option, and is incompatible with the `--reject` and the `--cached` options. |