Skip to content

chore: cleanup redundant .gitattributes files#8007

Merged
pearigee merged 7 commits intomainfrom
pearigee-gitattributes-cleanup
Apr 10, 2026
Merged

chore: cleanup redundant .gitattributes files#8007
pearigee merged 7 commits intomainfrom
pearigee-gitattributes-cleanup

Conversation

@pearigee
Copy link
Copy Markdown
Contributor

@pearigee pearigee commented Apr 9, 2026

Per googleapis/librarian#4582, our .gitattributes files don't need to defined on a per-package level.

Analyzing all of the .gitattributes files, they appear to fall into two main catagories:

1. Package-level .gitattributes

Almost every package in the repository (both in packages/ and handwritten/) contains an identical .gitattributes file with the following content:

*.ts text eol=lf
*.js text eol=lf
protos/* linguist-generated
**/api-extractor.json  linguist-language=JSON-with-Comments

Note: A few files (like packages/google-cloud-tasks/.gitattributes) appeared to have 3 lines instead of 4, but this was simply due to a missing trailing newline; the content was the same.

2. .kokoro directory .gitattributes

Files located in .kokoro directories generally contain just one line:

* linguist-generated=true

This marks all files within the .kokoro directory as "generated" so they are ignored in GitHub language statistics and diffs.

Consolidating these into a single .gitattributes file

It seems the important bits are simply this:

# Enforce LF line endings for all TS and JS files across the repo
*.ts text eol=lf
*.js text eol=lf

Optionally, we could include the Linguist specific changes (impacting GitHubs code statistics/diffs) but I don't think its strictly necessary. For now, I have opted to ignore them.

# Mark all protos directories as generated for Linguist (removing them from language stats and diffs)
**/protos/* linguist-generated

# Set language for api-extractor.json files
**/api-extractor.json linguist-language=JSON-with-Comments

# Mark all .kokoro directories as generated (removing them from language stats and diffs)
**/.kokoro/** linguist-generated

Generator updates (going to be a separate PR to reduce toil)

I am going to update the generator, to prevent the automatic generation of .gitattributes files, in a second PR since the change is a bit more involved and doesn't require such broad set of reviewers.

@pearigee pearigee requested review from a team as code owners April 9, 2026 23:28
@pearigee pearigee marked this pull request as draft April 9, 2026 23:28
@pearigee pearigee added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 9, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 9, 2026
@pearigee pearigee added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 9, 2026
@pearigee pearigee marked this pull request as ready for review April 9, 2026 23:37
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 10, 2026
Copy link
Copy Markdown
Contributor

@MarkDuckworth MarkDuckworth left a comment

Choose a reason for hiding this comment

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

LGTM firestore

@pearigee pearigee removed request for a team April 10, 2026 20:30
@pearigee pearigee added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 10, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 10, 2026
@GautamSharda
Copy link
Copy Markdown
Contributor

GautamSharda commented Apr 10, 2026

Do we only want to remove .gitattributes from firestore but not other handwritten/ packages?

@pearigee
Copy link
Copy Markdown
Contributor Author

Do we only want to remove .gitattributes from firestore but not other handwritten/ packages?

There are failing tests and it requires review from each of our partner teams.

I am going to send them fix and removal PRs separately.

@pearigee pearigee merged commit 5d85291 into main Apr 10, 2026
36 of 37 checks passed
@pearigee pearigee deleted the pearigee-gitattributes-cleanup branch April 10, 2026 23:34
vverman pushed a commit to vverman/google-cloud-node that referenced this pull request Apr 22, 2026
* chore: cleanup redundant .gitattributes files

* remove uneeded linguist configuration

* remove handwritten libraries for now (due to failing tests) except firestore which has already approved

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
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.

4 participants