git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: James Harvey <jamespharvey20@gmail.com>
To: git@vger.kernel.org, gitster@pobox.com
Subject: Request: git add --interactive: split hunk: When can't split further, split on empty lines
Date: Wed, 29 May 2019 20:19:45 -0400	[thread overview]
Message-ID: <CA+X5Wn5bt-3zHUqtRDWtc0A82SFmWPuQ0+RvRLaAV6Vn24nf4g@mail.gmail.com> (raw)

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,
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.

Example:

----------
int a() {
}

int b() {
}
----------

becomes

---------
int a() {
}
---------

int b() {
}
---------

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30  0:19 James Harvey [this message]
2019-05-30 14:53 ` Request: git add --interactive: split hunk: When can't split further, split on empty lines Johannes Schindelin
2019-05-30 19:26   ` Philip Oakley
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=CA+X5Wn5bt-3zHUqtRDWtc0A82SFmWPuQ0+RvRLaAV6Vn24nf4g@mail.gmail.com \
    --to=jamespharvey20@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).