git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] .gitattributes: set file type for C files
@ 2016-07-07 20:11 René Scharfe
  0 siblings, 0 replies; only message in thread
From: René Scharfe @ 2016-07-07 20:11 UTC (permalink / raw)
  To: Git List; +Cc: Junio C Hamano

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(-)

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-07-07 20:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 20:11 [PATCH] .gitattributes: set file type for C files René Scharfe

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).