git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git add --interactive patch improvement for split hunks
@ 2021-06-24 10:35 Ulrich Windl
  2021-06-24 15:41 ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Ulrich Windl @ 2021-06-24 10:35 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 2271 bytes --]

Hi!


I noticed that git add -interactive's patch displays the function context for the diffs, but that function context is lost when the hunks are split.
It would help the user (especially for hunks covering multiple functioins) if function context were still provided for split hunks.


Maybe just consider this (buggy) example (with screen shot in case the lines get severely mangled):
(15/20) Stage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? n
@@ -1097,13 +1743,13 @@ static inline    void    bitmap_copy_bits(
     }
     else
     {
-        const unsigned        s_i    = FASTBIT(s_pos);
-        const unsigned        d_i    = FASTBIT(d_pos);
+        const unsigned        s_i    = FASTBIT(s_pos + count);
+        const unsigned        d_i    = FASTBIT(d_pos + count);
         const fastword_t    *s_fw_p;
         fastword_t        *d_fw_p;
 
-        for ( s_fw_p = src->fast_words + FASTWORD(s_pos),
-              d_fw_p = dst->fast_words + FASTWORD(d_pos);
+        for ( s_fw_p = src->fast_words + FASTWORD(s_pos + count),
+              d_fw_p = dst->fast_words + FASTWORD(d_pos + count);
               count >= FASTWORD_BITS;
               --s_fw_p, --d_fw_p, count -= FASTWORD_BITS )
         {
(16/20) Stage this hunk [y,n,q,a,d,K,j,J,g,/,s,e,?]? s
Split into 2 hunks.
@@ -1097,8 +1743,8 @@
     }
     else
     {
-        const unsigned        s_i    = FASTBIT(s_pos);
-        const unsigned        d_i    = FASTBIT(d_pos);
+        const unsigned        s_i    = FASTBIT(s_pos + count);
+        const unsigned        d_i    = FASTBIT(d_pos + count);
         const fastword_t    *s_fw_p;
         fastword_t        *d_fw_p;
 
(16/21) Stage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]? n
@@ -1102,8 +1748,8 @@
         const fastword_t    *s_fw_p;
         fastword_t        *d_fw_p;
 
-        for ( s_fw_p = src->fast_words + FASTWORD(s_pos),
-              d_fw_p = dst->fast_words + FASTWORD(d_pos);
+        for ( s_fw_p = src->fast_words + FASTWORD(s_pos + count),
+              d_fw_p = dst->fast_words + FASTWORD(d_pos + count);
               count >= FASTWORD_BITS;
               --s_fw_p, --d_fw_p, count -= FASTWORD_BITS )
         {
(17/21) Stage this hunk [y,n,q,a,d,K,j,J,g,/,e,?]?




[-- Attachment #2: Screenshot from 2021-06-24 12-29-38.png --]
[-- Type: image/png, Size: 125599 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-30 17:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 10:35 git add --interactive patch improvement for split hunks Ulrich Windl
2021-06-24 15:41 ` Jeff King
2021-06-28 10:10   ` Antw: [EXT] " Ulrich Windl
2021-06-28 11:20     ` Ævar Arnfjörð Bjarmason
2021-06-30  2:16       ` Jeff King
2021-06-30  6:09         ` Junio C Hamano
2021-06-30  7:31           ` Jeff King
2021-06-30  8:27             ` Ævar Arnfjörð Bjarmason
2021-06-30 17:06               ` Jeff King

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