From 23f43f1abfa959baeb327cc6772dcac79abbb63a Mon Sep 17 00:00:00 2001 From: Andrew Clayton Date: Fri, 18 Jul 2025 19:20:46 +0100 Subject: [PATCH] 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. E.g. get @@ -10,7 +10,7 @@ int foo(void) instead of @@ -10,7 +10,7 @@ again: This has the same effect as adding [diff "default"] xfuncname = "^[[:alpha:]$_].*[^:]$" to your git config file. This makes use of the gitattributes(5) infrastructure. --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..b786b7913 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.[ch] diff=cpp