Subject: Re: [PATCH] add-patch: edit the hunk again

From: Junio C Hamano <[email-masked]>
Date: Mon, 16 Sep 2024 10:35:41 -0700

Phillip Wood <[email-masked]> writes:

> Because we know what the unedited patch
> looked like and that the pre-image lines should be unchanged it is
> possible to provide much better error messages than we get from trying
> to apply the whole patch with "git apply". It also makes it possible
> to restore deleted pre-image lines.
> ...
> [1] https://github.com/phillipwood/git/tree/wip/add-p-editing-improvements
>     Note that the later patches do not even compile at the moment. I've
>     been meaning to split out the first eight patches and clean them up
>     as they're mostly functional and just need the commit messages
>     cleaning up.

I'd love this.  With both patches before and after the edit session,
we should be able to give more accurate line counts than having "git
apply" look at only the post-edit shape of the hunk, which wouldn't
see where any brokenness of the hunk comes from even if it wanted
to.  We should probably be able to stop relying on "--recount" once
we do this right, which would be very nice outcome, too.

Thanks.