All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
@ 2011-08-25 22:37 Boaz Harrosh
  2011-08-26 20:27 ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Boaz Harrosh @ 2011-08-25 22:37 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, Git Mailing List, linux-kernel


The Linux Kernel source tree is certainly a C language repository.
As a maintainer and code reviewer I would like too, for example:
See function names as hunk headers and not goto labels. And all
the other goodies a language specific diff parser gives me.

Add a .gitattributes file to the Linux tree to enable cpp parsing
of the source files.

People are welcome to add other parsers for other type of files
if needed. (Like Makefile or Kconfig ...)

CC: Jeff King <peff@peff.net>
CC: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 .gitattributes |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
 create mode 100644 .gitattributes

diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6d2b620
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+*.h diff=cpp
+*.c diff=cpp
-- 
1.7.6


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-25 22:37 [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files Boaz Harrosh
@ 2011-08-26 20:27 ` Linus Torvalds
  2011-08-26 20:54   ` Junio C Hamano
  2011-08-26 20:55   ` Boaz Harrosh
  0 siblings, 2 replies; 10+ messages in thread
From: Linus Torvalds @ 2011-08-26 20:27 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Andrew Morton, Git Mailing List, linux-kernel, Junio C Hamano

On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>
> Add a .gitattributes file to the Linux tree to enable cpp parsing
> of the source files.

Hmm. I'm not entirely conviced. If people really think that the hunk
description matters that much, maybe we should just instead improve on
the automatic diff detection, and extend it from just binary-vs-text,
to also do the common hunk-headers.

After all, not having a diff pattern already *does* mean "automatic",
so it would be just a rather trivial extension to that.

Junio?

                     Linus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-26 20:27 ` Linus Torvalds
@ 2011-08-26 20:54   ` Junio C Hamano
  2011-08-26 20:59     ` Linus Torvalds
  2011-08-26 20:55   ` Boaz Harrosh
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2011-08-26 20:54 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Boaz Harrosh, Andrew Morton, Git Mailing List, linux-kernel

Linus Torvalds <torvalds@linux-foundation.org> writes:

> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>>
>> Add a .gitattributes file to the Linux tree to enable cpp parsing
>> of the source files.
>
> Hmm. I'm not entirely conviced. If people really think that the hunk
> description matters that much, maybe we should just instead improve on
> the automatic diff detection, and extend it from just binary-vs-text,
> to also do the common hunk-headers.
>
> After all, not having a diff pattern already *does* mean "automatic",
> so it would be just a rather trivial extension to that.

Not quite sure what you exactly mean by "extend it from just binary-vs-text".
Do you mean update buffer_is_binary() and add source language detection?

See also:

    http://thread.gmane.org/gmane.comp.version-control.git/180103/focus=180113


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-26 20:27 ` Linus Torvalds
  2011-08-26 20:54   ` Junio C Hamano
@ 2011-08-26 20:55   ` Boaz Harrosh
  2011-08-29 13:32     ` Peter Zijlstra
  1 sibling, 1 reply; 10+ messages in thread
From: Boaz Harrosh @ 2011-08-26 20:55 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Andrew Morton, Git Mailing List, linux-kernel, Junio C Hamano

On 08/26/2011 01:27 PM, Linus Torvalds wrote:
> On Thu, Aug 25, 2011 at 3:37 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>>
>> Add a .gitattributes file to the Linux tree to enable cpp parsing
>> of the source files.
> 
> Hmm. I'm not entirely conviced. If people really think that the hunk
> description matters that much, maybe we should just instead improve on
> the automatic diff detection, and extend it from just binary-vs-text,
> to also do the common hunk-headers.
> 
> After all, not having a diff pattern already *does* mean "automatic",
> so it would be just a rather trivial extension to that.
> 
> Junio?
> 

There was a patch submitted for new git version to auto detect file
extensions and do the right thing. 
(Look for the thread "git diff annoyance / feature request" on the git
 mailing list)

But this patch is for all the people and distributions that are going
to use the old git versions for a while, (Years).

It is important for the Linux mailing-list review, because you get
patches with:

@@@ lable out:
-	change foo
+	to bazz

And how the hell are you suppose to know where in the file it is.
This is such a trivial addition, that can help unify everyone's
usage. I don't see the down sides.

Thanks
Boaz

>                      Linus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-26 20:54   ` Junio C Hamano
@ 2011-08-26 20:59     ` Linus Torvalds
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Torvalds @ 2011-08-26 20:59 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Boaz Harrosh, Andrew Morton, Git Mailing List, linux-kernel

On Fri, Aug 26, 2011 at 1:54 PM, Junio C Hamano <gitster@pobox.com> wrote:
>
> Not quite sure what you exactly mean by "extend it from just binary-vs-text".
> Do you mean update buffer_is_binary() and add source language detection?

Yes. Except the "detection" would be just "if we auto-detect it as
text, then use the standard file extensions to also make an automatic
hunk rule detection".

So it would do the most common cases (*.[Cch] etc)

                         Linus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-26 20:55   ` Boaz Harrosh
@ 2011-08-29 13:32     ` Peter Zijlstra
  2011-08-29 20:57       ` Boaz Harrosh
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Zijlstra @ 2011-08-29 13:32 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Linus Torvalds, Andrew Morton, Git Mailing List, linux-kernel,
	Junio C Hamano

On Fri, 2011-08-26 at 13:55 -0700, Boaz Harrosh wrote:

> But this patch is for all the people and distributions that are going
> to use the old git versions for a while, (Years).
> 
> It is important for the Linux mailing-list review, because you get
> patches with:
> 
> @@@ lable out:
> -	change foo
> +	to bazz
> 
> And how the hell are you suppose to know where in the file it is.
> This is such a trivial addition, that can help unify everyone's
> usage. I don't see the down sides.

Ah, I'm using:

# cat ~/.gitconfig 
[diff "default"]
                xfuncname = "^[[:alpha:]$_].*[^:]$"


For this.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-29 13:32     ` Peter Zijlstra
@ 2011-08-29 20:57       ` Boaz Harrosh
  2011-08-29 21:30         ` Peter Zijlstra
  2011-08-29 22:02         ` Linus Torvalds
  0 siblings, 2 replies; 10+ messages in thread
From: Boaz Harrosh @ 2011-08-29 20:57 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Linus Torvalds, Andrew Morton, Git Mailing List, linux-kernel,
	Junio C Hamano

On 08/29/2011 06:32 AM, Peter Zijlstra wrote:
> On Fri, 2011-08-26 at 13:55 -0700, Boaz Harrosh wrote:
> 
>> But this patch is for all the people and distributions that are going
>> to use the old git versions for a while, (Years).
>>
>> It is important for the Linux mailing-list review, because you get
>> patches with:
>>
>> @@@ lable out:
>> -	change foo
>> +	to bazz
>>
>> And how the hell are you suppose to know where in the file it is.
>> This is such a trivial addition, that can help unify everyone's
>> usage. I don't see the down sides.
> 
> Ah, I'm using:
> 
> # cat ~/.gitconfig 
> [diff "default"]
>                 xfuncname = "^[[:alpha:]$_].*[^:]$"
> 
> 
> For this.

It looks like a lost cause so I'll try for the last time.

Everyone is suggesting that each one do his own cooked up secrets and solutions.
And those that are stupid and know nothing like me are un-lucky. But what I'm
proposing is that by just doing a "git clone" you'll be using these settings
that we like to see, when you send us your patches.

Adding a .gitattributes file to the Linux git tree is a very simple message.
"In the linux git tree all .c and .h files are c-source files" (And git will
treat them that way)

Now that was not so hard was it? Really, no one said anything bad or negative
about the patch, only excuses how it can be achieved, very difficultly, in
another way. So for the last time:
  What are you guys afraid of? what possibly could be bad about this patch?

Sigh

Good bye to this subject
Boaz

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-29 20:57       ` Boaz Harrosh
@ 2011-08-29 21:30         ` Peter Zijlstra
  2011-08-29 22:02         ` Linus Torvalds
  1 sibling, 0 replies; 10+ messages in thread
From: Peter Zijlstra @ 2011-08-29 21:30 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Linus Torvalds, Andrew Morton, Git Mailing List, linux-kernel,
	Junio C Hamano

On Mon, 2011-08-29 at 13:57 -0700, Boaz Harrosh wrote:
> 
> Adding a .gitattributes file to the Linux git tree is a very simple message.
> "In the linux git tree all .c and .h files are c-source files" (And git will
> treat them that way) 

I'm all for it, I hate those labels in git-diff output.. 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-29 20:57       ` Boaz Harrosh
  2011-08-29 21:30         ` Peter Zijlstra
@ 2011-08-29 22:02         ` Linus Torvalds
  2011-08-29 22:43           ` Boaz Harrosh
  1 sibling, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2011-08-29 22:02 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Peter Zijlstra, Andrew Morton, Git Mailing List, linux-kernel,
	Junio C Hamano

On Mon, Aug 29, 2011 at 1:57 PM, Boaz Harrosh <bharrosh@panasas.com> wrote:
>
>  What are you guys afraid of? what possibly could be bad about this patch?

I just detest filling the kernel tree with git stuff.

Right now, the only git-specific file we have in the kernel tree is
the ".gitignore" files, afaik. And if you were to use some other SCM,
the "ignore" model at least translates directly to just about anything
else (with the problem that the .gitignore model tends to be more
powerful than most other SCM's have, but whatever).

I'd hate to start populating the project with more stuff.

                     Linus

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files
  2011-08-29 22:02         ` Linus Torvalds
@ 2011-08-29 22:43           ` Boaz Harrosh
  0 siblings, 0 replies; 10+ messages in thread
From: Boaz Harrosh @ 2011-08-29 22:43 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Peter Zijlstra, Andrew Morton, Git Mailing List, linux-kernel,
	Junio C Hamano

On 08/29/2011 03:02 PM, Linus Torvalds wrote:
> 
> I'd hate to start populating the project with more stuff.
> 
>                      Linus

OK Thanks for the answer. That I can understand
Boaz

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-08-29 22:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-25 22:37 [PATCH] .gitattributes: Enable cpp diff parsing for .[ch] files Boaz Harrosh
2011-08-26 20:27 ` Linus Torvalds
2011-08-26 20:54   ` Junio C Hamano
2011-08-26 20:59     ` Linus Torvalds
2011-08-26 20:55   ` Boaz Harrosh
2011-08-29 13:32     ` Peter Zijlstra
2011-08-29 20:57       ` Boaz Harrosh
2011-08-29 21:30         ` Peter Zijlstra
2011-08-29 22:02         ` Linus Torvalds
2011-08-29 22:43           ` Boaz Harrosh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.