batman-adv: set git diff driver for C source code files

Message ID 20170221090640.14686-1-sven@narfation.org (mailing list archive)
State Accepted, archived
Commit eb819b8be1157f08a3e2b91ad303d0ee6caa64af
Delegated to: Simon Wunderlich
Headers

Commit Message

Sven Eckelmann Feb. 21, 2017, 9:06 a.m. UTC
  From: Jean Delvare <jdelvare@suse.de>

Git can be told to apply language-specific rules when generating diffs.
Enable this for C source code files (*.c and *.h) so that function names
are printed right.  Specifically, doing so prevents "git diff" from
mistakenly considering unindented goto labels as function names.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
[sven@narfation.org: Ported patch from linux.git]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 .gitattributes | 2 ++
 1 file changed, 2 insertions(+)
  

Comments

Sven Eckelmann Feb. 21, 2017, 5:26 p.m. UTC | #1
On Dienstag, 21. Februar 2017 10:06:40 CET Sven Eckelmann wrote:
> From: Jean Delvare <jdelvare@suse.de>
> 
> Git can be told to apply language-specific rules when generating diffs.
> Enable this for C source code files (*.c and *.h) so that function names
> are printed right.  Specifically, doing so prevents "git diff" from
> mistakenly considering unindented goto labels as function names.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> [sven@narfation.org: Ported patch from linux.git]
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---

Applied in e3bab02816097f860545d9ce9ae0808c69d7c92f [1].

Kind regards,
	Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/e3bab02816097f860545d9ce9ae0808c69d7c92f
  

Patch

diff --git a/.gitattributes b/.gitattributes
index eeef3e0..1d2a7e9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,4 @@ 
 /.gitignore export-ignore
 /.gitattributes export-ignore
+*.c   diff=cpp
+*.h   diff=cpp