Skip to content

fix(cli/dotfiles): add an exception for .gitconfig #9515

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

Merged
merged 4 commits into from
Sep 4, 2023

Conversation

matifali
Copy link
Member

@matifali matifali commented Sep 4, 2023

Resolves #8306

@matifali matifali added the cli Area: CLI label Sep 4, 2023
@matifali matifali self-assigned this Sep 4, 2023
@matifali matifali requested a review from mafredri September 4, 2023 12:13
@matifali matifali changed the title fix(cli/dotfiles): Only ignore .git directory fix(cli/dotfiles): only ignore .git directory Sep 4, 2023
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

I understand what prompted this change, but I think we need to make some changes. The .gitconfig does not have any special meaning inside a Git repository, so we can totally link it. However, we definitely shouldn't link .gitignore or .gitattributes files. These have special meaning to the actual repository being worked on and if a user has these in their dotfiles, we can't know for sure what their intent is, so linking is unsafe.

Imagine a dotfiles .gitignore file that ignores almost everything. Now it gets linked as global ignore and suddenly the files in all repositories are unattainable (or seem clean).

It might be a better idea for users to store their files in e.g. .config/git/config, .config/git/ignore, etc.

@matifali
Copy link
Member Author

matifali commented Sep 4, 2023

Thank you, @mafredri, for the detailed insights. I guess it's a very corner case with how people use dotfiles. So it's better if we close this for now. Should we close the issue as not planned, too?

@matifali matifali closed this Sep 4, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2023
@mafredri
Copy link
Member

mafredri commented Sep 4, 2023

@matifali I think we can change this to only be an exception for .gitconfig (allow), all other .git* files will still be ignored.

@matifali matifali reopened this Sep 4, 2023
@coder coder unlocked this conversation Sep 4, 2023
@matifali matifali changed the title fix(cli/dotfiles): only ignore .git directory fix(cli/dotfiles): add an exception for .gitconfig Sep 4, 2023
@matifali matifali requested a review from mafredri September 4, 2023 13:04
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Perf 👌🏻

@matifali matifali enabled auto-merge (squash) September 4, 2023 13:14
@matifali matifali merged commit 29b2eaa into main Sep 4, 2023
@matifali matifali deleted the fix-dotfiles-gitfiles branch September 4, 2023 13:17
@github-actions github-actions bot locked and limited conversation to collaborators Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cli Area: CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

coder dotfiles ignores '.git*' config files
2 participants