Skip to contentSkip to conversation

.gitattributes: set file type for C files

PATCH New René Scharfe 1 participant 1 message Jul 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 .gitattributes: set file type for C files

Set the diff attribute for C source file to "cpp" in order to improve git's ability to determine hunk headers. In particular it helps avoid showing unindented labels in hunk headers. That in turn is useful for git diff -W and git grep -W, which show whole functions now instead of stopping at a label.

---
 .gitattributes | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.gitattributes +1 -1
index 5e98806..320e33c 100644
@@ -1,3 +1,3 @@
 * whitespace=!indent,trail,space
-*.[ch] whitespace=indent,trail,space
+*.[ch] whitespace=indent,trail,space diff=cpp
 *.sh whitespace=indent,trail,space
Signature · 1 line
2.9.0