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

Antw: Re: java diffs show no method context

From
UWUlrich Windl <ulrich.windl@rz.uni-regensburg.de>
Date
Apr 26, 2018, 06:30 UTC
Message-ID
<5AE17203020000A10002B5EF@gwsmtp1.uni-regensburg.de>
In-Reply-To
<aae8d748-101d-1eb2-f8e8-9da2e53e2388@gmail.com>
Hi!

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

Regards, Ulrich

>>> Alban Gruin <alban.gruin@gmail.com> schrieb am 25.04.2018 um 17:05 in

Nachricht <aae8d748-101d-1eb2-f8e8-9da2e53e2388@gmail.com>:

Show 6 quoted lines
> Le 25/04/2018 à 14:53, Ulrich Windl a écrit :
>> Hi!
>> 
>> This is for git 2.13.6, and it may be an FAQ or frequent feature request. 
> Anyway:
>> I'm new to Java, and writing my first project using Git, I found that "git
> diff" only reports the class in the diff context, but not the method (as
seen 
Show 19 quoted lines
> for C, for example).
>> I'd wish to have the method where the diff is located.
> 
> Hi,
> 
> to achieve this behaviour, you have to create a file named
> ".gitattributes" at the root of your project, containing this line:
> 
> *.java diff=java
> 
> .gitattributes allows you to configure other things, as described in the
> documentation[1].
> 
> I hope it helps.
> 
> [1] https://www.git-scm.com/docs/gitattributes 
> 
> Cheers,
> Alban
Previous: Alban GruinNext: Ævar Arnfjörð Bjarmason
Message 3 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.