Add a .gitattributes file (#6381)

Currently this just sets the git diff driver for C source code files.

Git can be told to apply language-specific rules when generating diffs.
Enabling this for C source code files (*.c and *.h) means that function
names are printed correctly. Specifically, doing so prevents "git diff"
from mistakenly considering unindented goto labels as function names.

This has the same effect as adding

    [diff "default"]
        xfuncname = "^[[:alpha:]$_].*[^:]$"

to your git config file.

e.g get

    @@ -10,7 +10,7 @@ int main(void)

instead of

    @@ -10,7 +10,7 @@ again:

Signed-off-by: Andrew Clayton <andrew@zeta.digital-domain.net>
This commit is contained in:
Andrew Clayton 2019-07-05 10:54:32 +01:00 committed by Chris Akritidis
parent 55c8d98458
commit ffa23129c0
1 changed files with 2 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
*.c diff=cpp
*.h diff=cpp