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

Fix .env.local additions in .gitignore #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

evadecker
Copy link
Contributor

@evadecker evadecker commented Dec 22, 2024

Discussed in Discord here.

I'm working on an open source repo that requires contributors to initialize Convex on their local machines. I've noticed a few contributors push code that adds .env.local at the bottom of .gitignore, even though it's already listed above. I think this is being added automatically during the initialization process. Is there a way to disable this, or to improve the .gitignore pattern matching so it doesn't get added?

image

This PR updates the changesToGitIgnore() function to more robustly check for .env.local (and related variants), accounting for /r on Windows or extra whitespace which previously led to false positives.

New test cases were added to verify the updated conditions.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@evadecker
Copy link
Contributor Author

After reviewing the .gitignore spec: inline comments with # aren't valid. Comments must always start on a new line. Updated the matching + tests to reflect this.

@thomasballinger
Copy link
Collaborator

Thanks for the fix @evadecker! This PR merged in 1af1b7f

@evadecker
Copy link
Contributor Author

evadecker commented Dec 22, 2024

@thomasballinger it looks like the last commit in my PR was left out of the merged version.

I had to change some logic because inline comments aren't valid in .gitignore, and I was concerned splitting on # could potentially split a directory or file by mistake (very unlikely but possible)

c853fcc

Also added other test cases

@thomasballinger
Copy link
Collaborator

Oops, thanks. I'll fix that up and fix the script that pulls things into the other repo.

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