threads / patch / 42798

patch.gitattributes: set file type for C files

Subject: [PATCH] .gitattributes: set file type for C files

## tl;dr

One message between Jul 7, 2016 and Jul 7, 2016. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

René Scharfe· Jul 7, 2016, 20:11 UTC · lore

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.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 .gitattributes | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to .gitattributes +1 −1
diff --git a/.gitattributes b/.gitattributes
index 5e98806..320e33c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -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
-- 
2.9.0

← back to recent threads