Re: How to turn off rename detection for cherry-pick?
- From
Jeff King <peff@peff.net>
- Date
- Aug 29, 2024, 21:43 UTC
- Message-ID
- <20240829214336.GA440013@coredump.intra.peff.net>
- In-Reply-To
- <CAChcVunYDO_KAmEOoWEL2q63_Gzua-Kt3BmE5Snb8==K9Cww1w@mail.gmail.com>
On Thu, Aug 29, 2024 at 09:47:52AM +0100, Pavel Rappo wrote:
> The reason I ask this is that we've run into a (probably practically > rare) case where cherry-pick changes a wrong file. We want to be able > to detect such cases.
You can pass merge strategy options on the command line. The old "recursive" strategy has a "no-renames" option, so:
git cherry-pick --strategy=recursive -Xno-renames feature
generates a modify/delete conflict for your example. Curiously, the modern default, "ort", does not seem to respect that option. You can bump up the limit to require exact renames, though, which does prevent the mismerge in your case. Like:
git cherry-pick -Xfind-renames=100% feature
There are also other strategies that do not do rename detection, but I think you are better off using one of the more commonly-used strategies and just disabling renames. IMHO it's a bug that ort doesn't respect -Xno-renames.
-Peff