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.