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

Re: [PATCH] add -p: coalesce hunks before testing applicability

From
JSJochen Sprickerhof <jochen@sprickerhof.de>
Date
Sep 23, 2018, 17:16 UTC
Message-ID
<20180923171626.GN26251@vis>
In-Reply-To
<d6a8f77b-0a83-90ae-a7fb-a3954ac3b346@talktalk.net>
* Phillip Wood <phillip.wood@talktalk.net> [2018-09-13 11:20]:
>Yes in the long term we want to be able to coalesce edited hunks, but I
>think it is confusing to call coalesce_overlapping_hunks() at the moment
>as it will not coalesce the edited hunks.
I would see it as a first step into that direction.
Show 7 quoted lines
>I think that if you split a hunk, edit the first subhunk, transforming a
>trailing context line to a deletion then try if you try to stage the
>second subhunk it will fail. With your patch the edit will succeed as
>the second subhunk is skipped when testing the edited patch. Then when
>you try to stage the second subhunk it will fail as it's leading context
>will contradict the trailing lines of the edited subhunk. With the old
>method the edit failed but didn't store up trouble for the future.

Agreed. I guess the question is if you assume a hunk to be applied or skipped as the default. You can still find enough cases where neither the current nor the patched version works. I stumbled upon the one case where I wanted to stage only one part of a split hunk and that one worked after my patch. I leave it up to you if the added benefit overweights the stored up trouble.

Cheers Jochen
Previous: Phillip WoodNext: Johannes Schindelin
Message 7 of 12 in “add -p: coalesce hunks before testing applicability”
  1. add -p: coalesce hunks before testing applicabilityJochen Sprickerhof, Aug 28, 2018
  2. Junio C HamanoAug 28, 2018
  3. Phillip WoodAug 30, 2018
  4. Junio C HamanoAug 30, 2018
  5. Jochen SprickerhofSep 3, 2018
  6. Phillip WoodSep 13, 2018
  7. Jochen SprickerhofSep 23, 2018
  8. Johannes SchindelinMar 22, 2019
  9. Phillip WoodJun 2, 2019
  10. Johannes SchindelinJun 3, 2019
  11. Phillip WoodJun 3, 2019
  12. Johannes SchindelinJun 4, 2019

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.