Skip to content

chore: ignore .git directories in terraform modules #18255

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 2 commits into from
Jun 5, 2025

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jun 5, 2025

.git directories were causing identical modules to have different hashes. This adds unecessary bloat to the database, and the .git directory is not needed for dynamic params

.git directories were causing identical modules to have different
hashes. This adds unecessary bloat to the database, and the .git
directory is not needed for dynamic params
@Emyrk Emyrk requested a review from aslilac June 5, 2025 16:52
Comment on lines 108 to 109
// .git directories are not needed in the archive and only cause
// hash differences for identical modules.
Copy link
Member

Choose a reason for hiding this comment

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

I usually prefer to put these kinds of comments outside of the if. Then the explanation actually precedes the condition, rather than explaining it after the fact.

if fileMode.IsDir() && d.Name() == ".git" {
// .git directories are not needed in the archive and only cause
// hash differences for identical modules.
return fs.SkipDir
Copy link
Member

Choose a reason for hiding this comment

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

TIL

@Emyrk Emyrk merged commit 60595f3 into main Jun 5, 2025
34 checks passed
@Emyrk Emyrk deleted the stevenmasley/consistent_modules branch June 5, 2025 17:57
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