Commit 923cd87
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>1 parent 2e36527 commit 923cd87
File tree
3 files changed
+28
-10
lines changed- Documentation
- t
3 files changed
+28
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 87 | + | |
| 88 | + | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3570 | 3570 | | |
3571 | 3571 | | |
3572 | 3572 | | |
3573 | | - | |
| 3573 | + | |
3574 | 3574 | | |
3575 | 3575 | | |
3576 | | - | |
| 3576 | + | |
3577 | 3577 | | |
3578 | 3578 | | |
3579 | 3579 | | |
| |||
3605 | 3605 | | |
3606 | 3606 | | |
3607 | 3607 | | |
3608 | | - | |
| 3608 | + | |
3609 | 3609 | | |
3610 | 3610 | | |
3611 | 3611 | | |
| |||
3638 | 3638 | | |
3639 | 3639 | | |
3640 | 3640 | | |
3641 | | - | |
3642 | | - | |
| 3641 | + | |
3643 | 3642 | | |
3644 | | - | |
| 3643 | + | |
3645 | 3644 | | |
3646 | 3645 | | |
3647 | 3646 | | |
| |||
5018 | 5017 | | |
5019 | 5018 | | |
5020 | 5019 | | |
5021 | | - | |
| 5020 | + | |
5022 | 5021 | | |
5023 | 5022 | | |
5024 | 5023 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
163 | 183 | | |
0 commit comments