Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove defunct .gitconfig file #2078

Merged
merged 3 commits into from
Mar 21, 2025

Conversation

madmini
Copy link
Contributor

@madmini madmini commented Jun 14, 2024

The .gitconfig is not actually used by git unless manually configured to do so. The repo-specific git config is located in .git/config. The only .gitconfig file read by git is the one in the user home directory. See git config docs and the answers to this stackoverflow question.

I believe it is misleading to have this file in the repo as it implies the config is automatically applied. I for one have wasted a lot of time trying to fix the .gitconfig file before I realized this and came up with #2077 instead.

If I am mistaken and the .gitconfig file represents recommendations for contributors or similar then I strongly recommend to have this reflected somewhere in the docs, or noted as a comment in the defunct .gitconfig file.

@madmini
Copy link
Contributor Author

madmini commented Jun 14, 2024

The options, as outlined in #191 should probably be added to the docs.
#2077 should take care of line endings.

Copy link

github-actions bot commented Jun 14, 2024

Build size and comparison to main:

Section Size Difference
text 373088B 0B
data 948B 0B
bss 22536B 0B

Run in InfiniEmu

@madmini madmini force-pushed the chore/remove-defunct-gitconfig-file branch from d73e933 to a1add0a Compare November 22, 2024 10:48
@mark9064 mark9064 added the documentation Improvements or additions to documentation label Feb 12, 2025
@mark9064
Copy link
Member

Agreed, it makes sense to move it into the docs. I think it'd make sense to move it and remove the file at the same time (otherwise it might get forgotten about), would you be able to move it into the docs as part of this PR? If you don't have the time that's no problem, I'll try get round to it at some point.

Sorry for the glacial review :(

@madmini madmini force-pushed the chore/remove-defunct-gitconfig-file branch 2 times, most recently from 9b9eb68 to 4066cc0 Compare February 12, 2025 08:07
@madmini
Copy link
Contributor Author

madmini commented Feb 12, 2025

I have added git config set ... to "Clone the repo" steps in the docs. Not sure if this is enough and/or the right place.

I have considered adding a bullet point to the "PR checklist" in CONTRIBUTING.md:

  • Configure Git to automatically fix whitespace issues:

    git config set core.whitespace trailing-space,space-before-tab
    git config set apply.whitespace fix

but this seems a bit out of place.

Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually on further thought, I think it might just be best to remove it:
whitespace = blank-at-eol,blank-at-eof,space-before-tab is the default, so this line does nothing unless you modified your global git config (and you better know what you're doing if you have)
And bad whitespace in general will be caught by clang-format, so CI will fail. I suspect most people are using editors which strip whitespace anyway: I don't think anybody really knows about the .gitconfig and I haven't seen any whitespace issues when reviewing

What do you think?

@madmini
Copy link
Contributor Author

madmini commented Feb 14, 2025

whitespace = blank-at-eol,blank-at-eof,space-before-tab is the default

ah, I missed this. for some reason I believed that one of them was not default.

bad whitespace in general will be caught by clang-format, so CI will fail

I assume clang-format will only format C files? Then python scripts and other stuff require extra attention. But yes, I think this is the way to go.

I suspect most people are using editors which strip whitespace anyway

yes

I don't think anybody really knows about the .gitconfig

certainly not me before googling for this PR 😅

What do you think?

I have not yet seen many projects that make recommendations for git config and I think my current way to put it in the docs (add git config ... to any git clone ... instructions) is weird and prone to be ignored. If you want standards to be enforced, then check them in CI, as you do. So as the settings are the default anyway AND for C code its checked in CI AND its weird, I'm with you on just removing it.

I'll add a revert commit, just squash it ^^

Copy link
Member

@mark9064 mark9064 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fully agree, thanks for the comments and patch :)

@mark9064 mark9064 added this to the 1.16.0 milestone Feb 14, 2025
@madmini madmini force-pushed the chore/remove-defunct-gitconfig-file branch from 24dccce to 6c8562b Compare March 2, 2025 17:01
@JF002 JF002 merged commit 6a6981c into InfiniTimeOrg:main Mar 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants