Re: Better suggestions when git-am(1) fails
- From
Jeff King <peff@peff.net>
- Date
- Mar 9, 2023, 03:17 UTC
- Message-ID
- <ZAlPtxZ/0Z28r5tF@coredump.intra.peff.net>
- In-Reply-To
- <897c200c-afb3-ceb4-bf44-9af651f5feb4@gmail.com>
On Wed, Mar 08, 2023 at 09:15:53PM +0100, Alejandro Colomar wrote:
> I had the following error already a few times, when some contributors, > for some reason unknown to me, remove the leading path components from > the patch.
The reason is probably that they have set diff.noprefix in their config, and git-format-patch respects that. Which is arguably a bug. There's a little discussion in this message, along with references to some previous discussions:
https://lore.kernel.org/git/ZAWnDUkgO5clf6qu@coredump.intra.peff.net/
> Now I know that the fix is to use -p0, but the first times it wasn't > obvious. And still I forget about -p0 sometimes and it's hard to find > in the manual pages. I think it would be good to suggest using it > when such an error appears.
I agree it may be reasonable to have "git am" be more helpful on the receiving side. Hopefully if format-patch is changed then you wouldn't see the situation as often, but it could still happen.
-Peff