git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Feature Request: Custom split location for `git add --patch`

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2022, 15:49 UTC
Message-ID
<xmqq4k0ej9tl.fsf@gitster.g>
In-Reply-To
<nycvar.QRO.7.76.6.2206181359400.349@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 25 quoted lines
> Hi Dennis,
>
> On Thu, 16 Jun 2022, Dennis van Gerwen wrote:
>
> ...
> Note how the `-` line became a context line? It _has_ to be, otherwise the
> second hunk could not be applied as-is. That is, until the first hunk has
> been applied. In which case the second hunk needs to be modified:
>
> 	-- snip --
> 	@@
> 	 All journeys start with a first step.
>
> 	+Actually, some journeys, some interesting ones, end in a disaster
> 	+right at the start, because the first step was skipped.
>
> 	 And this concludes the chapter. Good night.
> 	-- snap --
>
> Now the `[tbd]` line in the context has vanished.
>
> This is really an important concept to keep in mind: if you split at
> context lines, your hunks can remain immutable. If you want to split
> elsewhere, after one of the hunks resulting from said split is a applied,
> you have to recompute the other hunk.
Good write-up.
Previous: Johannes Schindelin
Message 3 of 3 in “Feature Request: Custom split location for `git add --patch`”
  1. Dennis van GerwenJun 16, 2022
  2. Johannes SchindelinJun 18, 2022
  3. Junio C HamanoJun 21, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.