Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

ac000
Copy link
Member

@ac000 ac000 commented Jul 18, 2025

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.

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.
@pluknet
Copy link
Contributor

pluknet commented Jul 21, 2025

I don't like polluting repo with more git stuff, which can be done without.

If one suffers from unintended goto labels, they can customize a local git configuration file.
After all, to review the patch, you have to apply it anyway.

(Regarding the commit log, it's definitely not what I'd like to see here.)

@ac000
Copy link
Member Author

ac000 commented Jul 22, 2025

I don't like polluting repo

What you call polluting, I call enhancing...

with more git stuff,

Yet git is what we're using, so I'm not sure what you expect...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants