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

Re: Alternative to manual editing with git add --patch

From
Sven Helmberger <sven.helmberger@gmx.de>
Date
Oct 14, 2015, 23:36 UTC
Message-ID
<561EE700.3020002@gmx.de>
In-Reply-To
<xmqqk2qp8hlj.fsf@gitster.mtv.corp.google.com>
Am 14.10.2015 um 19:50 schrieb Junio C Hamano:
Show 9 quoted lines
> Sven Helmberger <sven.helmberger@gmx.de> writes:
> 
> As a quick-and-dirty change, you could invent a new variant of
> 's'plit that breaks a N-line hunk into N hunks with 1-line each, but
> obviously that would not be a pleasant-enough UI to be called usable
> when you have a hunk that adds 100 lines.  Perhaps "Split this hunk
> into two by ending the earlier one immediately before the line that
> has this substring" or something might be an idea?
> 

If we go by the style of interaction in git add --patch and git add --interactive, I think the most canonical solution would be to implement it like this.

If we know when we can't split the current patch any further ( the point at which selecting s changes nothing anymore), why shouldn't add --patch not work similar to add --interactive in that it prints the lines of the diff prefixed with numbers and the user can define a numerical range to "split off". Then they decide whether to add those lines or not and return to the line-numbers until they're trough with the patch.

Regards, Sven Helmberger

Previous: Junio C HamanoNext: Johannes Schindelin
Message 5 of 9 in “Alternative to manual editing with git add --patch”
  1. Sven HelmbergerOct 14, 2015
  2. Matthieu MoyOct 14, 2015
  3. Johannes SchindelinOct 14, 2015
  4. Junio C HamanoOct 14, 2015
  5. Sven HelmbergerOct 14, 2015
  6. Johannes SchindelinOct 15, 2015
  7. Sven HelmbergerOct 15, 2015
  8. Johannes SchindelinOct 15, 2015
  9. Sven HelmbergerOct 15, 2015

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.