* [dpdk-dev] [PATCH] improve git diff
@ 2016-11-09 15:44 Thomas Monjalon
2016-11-11 11:22 ` Ferruh Yigit
2016-11-13 14:21 ` Thomas Monjalon
0 siblings, 2 replies; 6+ messages in thread
From: Thomas Monjalon @ 2016-11-09 15:44 UTC (permalink / raw)
To: dev
Sometimes git does not print the name of the function being changed
after @@. It happens especially after a goto label which is not indented.
Giving a hint about the languages of files .c, .h and .py
will improve hunk headers of "git diff" rendering.
Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
---
.gitattributes | 3 +++
1 file changed, 3 insertions(+)
create mode 100644 .gitattributes
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..fe555f8
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+*.c diff=cpp
+*.h diff=cpp
+*.py diff=python
--
2.7.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] improve git diff
2016-11-09 15:44 [dpdk-dev] [PATCH] improve git diff Thomas Monjalon
@ 2016-11-11 11:22 ` Ferruh Yigit
2016-11-11 16:21 ` Thomas Monjalon
2016-11-13 14:21 ` Thomas Monjalon
1 sibling, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2016-11-11 11:22 UTC (permalink / raw)
To: Thomas Monjalon, dev
On 11/9/2016 3:44 PM, Thomas Monjalon wrote:
> Sometimes git does not print the name of the function being changed
> after @@. It happens especially after a goto label which is not indented.
> Giving a hint about the languages of files .c, .h and .py
> will improve hunk headers of "git diff" rendering.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> ---
> .gitattributes | 3 +++
> 1 file changed, 3 insertions(+)
> create mode 100644 .gitattributes
>
> diff --git a/.gitattributes b/.gitattributes
> new file mode 100644
> index 0000000..fe555f8
> --- /dev/null
> +++ b/.gitattributes
> @@ -0,0 +1,3 @@
> +*.c diff=cpp
> +*.h diff=cpp
Can't git auto detect to use C/C++ language diff use for .c/.h files?
Do you have a sample that generates bad hunk header, just to test?
> +*.py diff=python
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] improve git diff
2016-11-11 11:22 ` Ferruh Yigit
@ 2016-11-11 16:21 ` Thomas Monjalon
2016-11-11 17:28 ` Ferruh Yigit
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2016-11-11 16:21 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
2016-11-11 11:22, Ferruh Yigit:
> On 11/9/2016 3:44 PM, Thomas Monjalon wrote:
> > Sometimes git does not print the name of the function being changed
> > after @@. It happens especially after a goto label which is not indented.
> > Giving a hint about the languages of files .c, .h and .py
> > will improve hunk headers of "git diff" rendering.
> >
> > Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
[...]
> > --- /dev/null
> > +++ b/.gitattributes
> > @@ -0,0 +1,3 @@
> > +*.c diff=cpp
> > +*.h diff=cpp
>
> Can't git auto detect to use C/C++ language diff use for .c/.h files?
No
> Do you have a sample that generates bad hunk header, just to test?
Yes, you'll find a lot of them with "git log -p | grep '@@.*:'"
Example:
git show bb6722f | grep '@@.*:'
Without the patch, it is a goto label in the hunk header.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] improve git diff
2016-11-11 16:21 ` Thomas Monjalon
@ 2016-11-11 17:28 ` Ferruh Yigit
2016-11-12 20:51 ` Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Ferruh Yigit @ 2016-11-11 17:28 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev
On 11/11/2016 4:21 PM, Thomas Monjalon wrote:
> 2016-11-11 11:22, Ferruh Yigit:
>> On 11/9/2016 3:44 PM, Thomas Monjalon wrote:
>>> Sometimes git does not print the name of the function being changed
>>> after @@. It happens especially after a goto label which is not indented.
>>> Giving a hint about the languages of files .c, .h and .py
>>> will improve hunk headers of "git diff" rendering.
>>>
>>> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> [...]
>>> --- /dev/null
>>> +++ b/.gitattributes
>>> @@ -0,0 +1,3 @@
>>> +*.c diff=cpp
>>> +*.h diff=cpp
>>
>> Can't git auto detect to use C/C++ language diff use for .c/.h files?
>
> No
>
>> Do you have a sample that generates bad hunk header, just to test?
>
> Yes, you'll find a lot of them with "git log -p | grep '@@.*:'"
> Example:
> git show bb6722f | grep '@@.*:'
> Without the patch, it is a goto label in the hunk header.
>
You are right, I was expecting better from git J
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] improve git diff
2016-11-11 17:28 ` Ferruh Yigit
@ 2016-11-12 20:51 ` Thomas Monjalon
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2016-11-12 20:51 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev
2016-11-11 17:28, Ferruh Yigit:
> On 11/11/2016 4:21 PM, Thomas Monjalon wrote:
> > 2016-11-11 11:22, Ferruh Yigit:
> >> On 11/9/2016 3:44 PM, Thomas Monjalon wrote:
> >>> Sometimes git does not print the name of the function being changed
> >>> after @@. It happens especially after a goto label which is not indented.
> >>> Giving a hint about the languages of files .c, .h and .py
> >>> will improve hunk headers of "git diff" rendering.
> >>>
> >>> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
> > [...]
> >>> --- /dev/null
> >>> +++ b/.gitattributes
> >>> @@ -0,0 +1,3 @@
> >>> +*.c diff=cpp
> >>> +*.h diff=cpp
> >>
> >> Can't git auto detect to use C/C++ language diff use for .c/.h files?
> >
> > No
> >
> >> Do you have a sample that generates bad hunk header, just to test?
> >
> > Yes, you'll find a lot of them with "git log -p | grep '@@.*:'"
> > Example:
> > git show bb6722f | grep '@@.*:'
> > Without the patch, it is a goto label in the hunk header.
> >
>
> You are right, I was expecting better from git J
Sometimes, less is more :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH] improve git diff
2016-11-09 15:44 [dpdk-dev] [PATCH] improve git diff Thomas Monjalon
2016-11-11 11:22 ` Ferruh Yigit
@ 2016-11-13 14:21 ` Thomas Monjalon
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2016-11-13 14:21 UTC (permalink / raw)
To: dev
2016-11-09 16:44, Thomas Monjalon:
> Sometimes git does not print the name of the function being changed
> after @@. It happens especially after a goto label which is not indented.
> Giving a hint about the languages of files .c, .h and .py
> will improve hunk headers of "git diff" rendering.
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Applied
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-11-13 18:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-09 15:44 [dpdk-dev] [PATCH] improve git diff Thomas Monjalon
2016-11-11 11:22 ` Ferruh Yigit
2016-11-11 16:21 ` Thomas Monjalon
2016-11-11 17:28 ` Ferruh Yigit
2016-11-12 20:51 ` Thomas Monjalon
2016-11-13 14:21 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).