Skip to contentSkip to conversation

Set git diff driver for C source code files

PATCH Applied Jean Delvare 1 participant 1 message Sep 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set git diff driver for C source code files

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.

Cc Peter Zijlstra <[email protected]>
Cc Joe Perches <[email protected]>
Cc Jonathan Corbet <[email protected]>
---
 .gitattributes |    2 ++
 1 file changed, 2 insertions(+)
.gitattributes new file +2 -0
@@ -0,0 +1,2 @@
+*.c   diff=cpp
+*.h   diff=cpp
Signature · 2 lines
Jean Delvare
SUSE L3 Support