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

Re: Antw: [EXT] Re: git add --interactive patch improvement for split hunks

From
Jeff King <peff@peff.net>
Date
Jun 30, 2021, 02:16 UTC
Message-ID
<YNvT+tUlW98dQY3B@coredump.intra.peff.net>
In-Reply-To
<87eecmgrnx.fsf@evledraar.gmail.com>
On Mon, Jun 28, 2021 at 01:20:46PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 9 quoted lines
> > There always was a related bug (IMHO) that showed the context of the
> > previous function even though the actual change was within a new
> > function (that starts within the context lines). So if that bug were
> > fixed, my guess is that the other would be as well.
> > However I don't know how easy or hard the fix will be.
> > Maybe the "definition" of function context is just different; I don't really know.
> 
> Does that bug perhaps have anything to do with:
> https://lore.kernel.org/git/20210215155020.2804-2-avarab@gmail.com/

I think it's similar. The issue is that we search backwards for a funcname match from the top of the hunk, _not_ from the first changed line. IIRC, that has been discussed before and considered "not a bug", but I could be mis-remembering (and it's a tricky thing to search in the archive for[0]).

The problem with split hunks is different, though; we do not search for a funcname line at all on the second half of the hunk.

-Peff
[0] I did come up with:
      https://lore.kernel.org/git/1399824596-4670-1-git-send-email-avarab@gmail.com/
    which has discussion between you and me on this very same splitting
    topic back in 2014! Double-curious, your patch there implements the
    same "keep the hunk header on split" we've been discussing here, and
    we were all positive on it. Yet it doesn't seem to have ever gotten
    applied.
    It looks like Junio carried it in "What's Cooking" for almost a
    year, marked as "waiting for re-roll" to handle the squash, but then
    eventually discarded it as stale. :(
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 5 of 9 in “git add --interactive patch improvement for split hunks”
  1. Ulrich WindlJun 24, 2021
  2. Jeff KingJun 24, 2021
  3. Antw: [EXT] Re: git add --interactive patch improvement for split hunksUlrich Windl, Jun 28, 2021
  4. Ævar Arnfjörð BjarmasonJun 28, 2021
  5. Jeff KingJun 30, 2021
  6. Junio C HamanoJun 30, 2021
  7. Jeff KingJun 30, 2021
  8. Ævar Arnfjörð BjarmasonJun 30, 2021
  9. Jeff KingJun 30, 2021

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.