git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philip Oakley <philipoakley@iee.org>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	James Harvey <jamespharvey20@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: Request: git add --interactive: split hunk: When can't split further, split on empty lines
Date: Thu, 30 May 2019 20:26:29 +0100	[thread overview]
Message-ID: <aad93135-6280-ac6a-c72a-8a325fbbaf67@iee.org> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1905301644020.44@tvgsbejvaqbjf.bet>

Hi,  some minor comments.
On 30/05/2019 15:53, Johannes Schindelin wrote:
> Hi James,
>
> On Wed, 29 May 2019, James Harvey wrote:
>
>> When adding interactively, 's' can be used to split the current hunk.
>> Once it gets down to where 's' reports "Sorry, cannot split this
>> hunk", it could be useful if it would then start splitting based on
>> empty lines, probably leaving empty lines at the top of the split
>> hunks.  It certainly wouldn't be perfect, and might create many hunks,
A binary search style split may be an option to avoid the 'many hunks' 
issue.
>> but it would be a nice alternative to manually editing the hunk.
>> Certainly someone could still manually edit the hunk if they didn't
>> want to use it in a particular situation.
> While a neat idea from the users' perspective, I think that it is
> technically a bit challenging, as you then have a problem to coalesce the
> patches appropriately.
>
> The thing with the splitting at context lines is that you have a much
> easier time to merge individual split-hunks into a "coalesced" hunk
> because the context lines stay context lines.
>
> Having said that, there was a patch series recently to add the ability to
> stage individual lines,
I believe that the git-gui (in tk/tcl, but using git commands) was 
already able to stage individual/selected lines, so there may be some 
ideas from there.

> and I think that your feature request could be
> implemented on top of that.
>
> In the meantime, an Outreachy intern and I worked on turning `git add -i`
> into a built-in (it was written in Perl, and the built-in is written in
> portable C instead), and I *think* that the plan with the patch series to
> stage individual lines was to re-implement it on top of the built-in patch
> series.
>
> Would you be interested in participating in that project?
>
> Ciao,
> Johannes
--
Philip

  reply	other threads:[~2019-05-30 19:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30  0:19 Request: git add --interactive: split hunk: When can't split further, split on empty lines James Harvey
2019-05-30 14:53 ` Johannes Schindelin
2019-05-30 19:26   ` Philip Oakley [this message]
2019-05-30 19:43     ` Johannes Schindelin
2019-05-30 20:30       ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aad93135-6280-ac6a-c72a-8a325fbbaf67@iee.org \
    --to=philipoakley@iee.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jamespharvey20@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).