threads / patch / 15024

patchEnable diff=java for all *.java source files

Subject: [EGIT PATCH] Enable diff=java for all *.java source files

## tl;dr

3 messages between Aug 15, 2008 and Aug 18, 2008. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Shawn O. Pearce· Aug 15, 2008, 15:40 UTC · lore

This (usually) gets more reasonable function headers to appear in the header line for a diff hunk. Its slightly better than the default C rules.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .gitattributes |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 .gitattributes
Show changes to .gitattributes +1 −0
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..f57840b
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.java diff=java
-- 
1.6.0.rc3.250.g8dd0
Robin Rosenberg· Aug 18, 2008, 05:38 UTC · re: Shawn O. Pearce · lore

Re: [EGIT PATCH] Enable diff=java for all *.java source files

fredagen den 15 augusti 2008 17.40.22 skrev Shawn O. Pearce:
Show 17 quoted lines
> This (usually) gets more reasonable function headers to
> appear in the header line for a diff hunk.  Its slightly
> better than the default C rules.
> 
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> ---
>  .gitattributes |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>  create mode 100644 .gitattributes
> 
> diff --git a/.gitattributes b/.gitattributes
> new file mode 100644
> index 0000000..f57840b
> --- /dev/null
> +++ b/.gitattributes
> @@ -0,0 +1 @@
> +*.java diff=java
Is there any reason this isn't the default in git?
-- robin
Shawn O. Pearce· Aug 18, 2008, 05:49 UTC · re: Robin Rosenberg · lore

Re: [EGIT PATCH] Enable diff=java for all *.java source files

Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
Show 9 quoted lines
> > diff --git a/.gitattributes b/.gitattributes
> > new file mode 100644
> > index 0000000..f57840b
> > --- /dev/null
> > +++ b/.gitattributes
> > @@ -0,0 +1 @@
> > +*.java diff=java
> 
> Is there any reason this isn't the default in git?
Because uh.  Nobody submitted a patch to make it the default?

It does seem like it would be a good idea to make it the default. Its unlikely the C function header pattern is ever going to produce a more reasonable hunk header for a *.java file than the Java pattern.

-- 
Shawn.

← back to recent threads