From: Johannes Sixt Date: Sat, 08 Nov 2025 08:26:15 GMT Subject: Re: [Bug report] git cherry-pick silently ignores error whereas git apply fails for hunk apply Message-ID: <6f9a0358-4d87-477a-a067-081ce6b2d102@kdbg.org> In-Reply-To: Am 08.11.25 um 04:44 schrieb Bhavik Bavishi: >>> If you use `git apply --3way`, does it still fail, or does it succeed >>> and does it produce the same result as `git cherry-pick` or a different >>> result? >> I've compare the file content of `mango/utils/apple_utils.cc` for `git > apply --3way` and `git cherry-pick` is same > > If I understand correctly, `git cherry-pick` is processed as expected, but for > some reason we are not able to follow this behavior because the end result is > missing content. expectation was to have this content either be applied > successfully or fail with a conflict (indicating it could not be applied). > > query: is there a way to understand this behavior? Based on that, we can then > correct or update the file format to avoid such issues in the future, or > introduce an additional process to run `git apply` (without `--3way`) and check > if there is any hunk failed to apply and notify for the same. `git cherry-pick` and `git apply --3wax` use a merge strategy. If this operation omits a change, then it is usually the case that it was determined that the change was already applied independently. This in turn can happen in a situation where there are repeated occurrences of the same text, and only some of them are changed, like this (and I am speculating here): base: ...ABC...ABC... theirs: ...ABC...AXC... ours: .........AXC...ABC... Here, the merge strategy thinks that the change of the second "ABC" to "AXC" on their side matches up with the first "ABC", but that has already been changed to "AXC" independently on our side, hence, there is nothing more to do. -- Hannes