Search code examples
githubgithub-linguist

Why did GitHub decide my (100% C) repository was 50% C++?


I have a GitHub repository that is C-only. After my latest commit, in which I modified preprocessor spacing in a header file, GitHub decided my repository was 50.2% C++. I clicked on the link to look at the C++ code and it showed my header file portable.h.

Why does GitHub think my repo is 50% C++? And more importantly, how can I change its mind?


Solution

  • I figured out how to fix it. I added a linguist override line to my .gitattributes file:

    *.h linguist-language=C
    

    I'm still not sure why GitHub decided the file was C++. If an answer is posted which solves that question, I'll accept it.