summaryrefslogtreecommitdiff
path: root/builtin/archive.c
diff options
context:
space:
mode:
authorLibravatar Jerry Zhang <jerry@skydio.com>2021-04-06 16:25:32 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-04-06 17:11:41 -0700
commit923cd87ac8550a8e277bfeb19198a11b6a8ed854 (patch)
treec52acf27d606da3c6e8dee0e9bafd010c5986c78 /builtin/archive.c
parentThe sixth batch (diff)
downloadtgif-923cd87ac8550a8e277bfeb19198a11b6a8ed854.tar.xz
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 'builtin/archive.c')
0 files changed, 0 insertions, 0 deletions