Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-12 Thread Jeff King
On Sun, May 11, 2014 at 04:09:56PM +, Ævar Arnfjörð Bjarmason wrote: Change the display of hunks in hunk splitting mode to preserve the diff heading, which hasn't been done ever since the hunk splitting was initially added in v1.4.4.2-270-g835b2ae. Splitting the first hunk of this patch

Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-12 Thread Ævar Arnfjörð Bjarmason
On Mon, May 12, 2014 at 8:39 PM, Jeff King p...@peff.net wrote: On Sun, May 11, 2014 at 04:09:56PM +, Ævar Arnfjörð Bjarmason wrote: Change the display of hunks in hunk splitting mode to preserve the diff heading, which hasn't been done ever since the hunk splitting was initially added in

Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-12 Thread Jeff King
On Mon, May 12, 2014 at 09:42:56PM +0200, Ævar Arnfjörð Bjarmason wrote: Good suggestion, but tricky as you point out. Another thing I've wanted many times is to make it smart enough that when you edit code like: A() B(); And change it to: X(); Y(); The change from A-X

Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-12 Thread Junio C Hamano
Jeff King p...@peff.net writes: One, there is a slightly funny artifact in that the hunk header comes from the top of the context line, and that top is a different position for each of the split hunks. So in a file like: header_A content header_B one two

Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-12 Thread Jeff King
On Mon, May 12, 2014 at 02:07:15PM -0700, Junio C Hamano wrote: And figuring out B here would be prohibitively difficult, I would think, as it would require applying the funcname rules internal to git-diff to a hunk that git-diff itself never actually sees. You can actually apply a

Re: [PATCH] git-add--interactive: Preserve diff heading when splitting hunks

2014-05-11 Thread Junio C Hamano
Ævar Arnfjörð Bjarmason ava...@gmail.com writes: Change the display of hunks in hunk splitting mode to preserve the diff heading, which hasn't been done ever since the hunk splitting was initially added in v1.4.4.2-270-g835b2ae. Splitting the first hunk of this patch will now result in: