diff options
author | Andrew Clayton <andrew@digital-domain.net> | 2019-07-05 10:54:32 +0100 |
---|---|---|
committer | Chris Akritidis <43294513+cakrit@users.noreply.github.com> | 2019-07-05 11:54:32 +0200 |
commit | ffa23129c03ba1e162cb22a00c64439f68390470 (patch) | |
tree | 7223cd84ec4bd25d69b2582d99a88793225bfb3a /.gitattributes | |
parent | 55c8d98458ab977d74937e8ec273aec3f1ac5c8a (diff) |
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>
Diffstat (limited to '.gitattributes')
-rw-r--r-- | .gitattributes | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..45ec5156ac --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.c diff=cpp +*.h diff=cpp |