Skip to content

Commit

Permalink
Add a .gitattributes file (netdata#6381)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ac000 authored and cakrit committed Jul 5, 2019
1 parent 55c8d98 commit ffa2312
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.c diff=cpp
*.h diff=cpp

0 comments on commit ffa2312

Please sign in to comment.