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

Re: Antw: Re: java diffs show no method context

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 26, 2018, 07:43 UTC
Message-ID
<87y3hacszl.fsf@evledraar.gmail.com>
In-Reply-To
<5AE17203020000A10002B5EF@gwsmtp1.uni-regensburg.de>
On Thu, Apr 26 2018, Ulrich Windl wrote:
> Thanks for that. It sounds plausible, but I wonder why it works automagically
> for C, but not for Java (Politcal reasons put aside): Using ".c" for C is about
> as common as using ".java" for Java ;-)

It has a bit to do with it being in C, but not in the way you think. By default Git doesn't enable the "cpp" driver either for *.c, but it just so happens to do the right thing more of the time because the default heuristic is basically to search for a nearby line that doesn't start with whitespace for context.

This doesn't work for Java because your methods tend to be indented since they're part of the class you're working on.

Previous: Ulrich Windl
Message 4 of 4 in “java diffs show no method context”
  1. Ulrich WindlApr 25, 2018
  2. Alban GruinApr 25, 2018
  3. Antw: Re: java diffs show no method contextUlrich Windl, Apr 26, 2018
  4. Ævar Arnfjörð BjarmasonApr 26, 2018

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.