-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Problem description
Line ending handling is currently not defined consistently across CAMARA repositories. This allows CRLF to be introduced again depending on editor settings and operating system defaults, and it can also create cosmetic diffs in generated or normalized artifacts.
For new repositories, the expected direction is clear:
- add
.editorconfigto guide editor behavior - add
.gitattributesto enforce line endings at the Git layer - include both files in
Template_API_repository
The open question is how to migrate and align existing repositories in a controlled way. This is especially relevant now, because most Fall25 repositories have not yet started their Sync26 work, so there is still a good window for a coordinated cleanup campaign with limited disruption.
Possible evolution
Define a CAMARA-wide LF policy for text files and implement it in two places:
.editorconfigfor editor-side defaults.gitattributesfor repository-side enforcement
For new repositories:
- update
Template_API_repositoryto include both files by default
For existing repositories:
- run a migration campaign across the relevant Fall25 repositories before Sync26 work starts
- ensure migration PRs are limited to line-ending policy and normalization only, with no functional changes mixed in
Two rollout options are possible:
Option 1: two PRs per repository
- PR 1 adds
.editorconfigand.gitattributes - PR 2 performs line-ending normalization only
Pros:
- cleaner review separation between policy introduction and file normalization
- easier to explain and audit
- lower risk if maintainers want to validate the policy before mass file changes
Cons:
- doubles the number of PRs to prepare, review, and merge
- extends the campaign duration
- may create extra coordination overhead across many repositories
Option 2: one centrally prepared PR per repository combining policy + normalization
- add
.editorconfigand.gitattributes - include the normalization changes in the same PR
Pros:
- faster rollout with fewer PRs overall
- less administrative overhead for the campaign
- each repository is aligned in a single step
Cons:
- larger diffs that may be harder to review
- more likely that GitHub shows files as broadly replaced because of line-ending changes
- policy definition and normalization are coupled, so review is less granular
Alternative solution
Do not run a migration campaign for existing repositories and only update Template_API_repository for future repositories.
This would improve the baseline going forward, but it would leave existing repositories inconsistent and would not reduce the chance of CRLF-related churn in current maintenance and release flows.
Additional context
A practical implementation detail is that .gitattributes should be treated as the authoritative enforcement mechanism, while .editorconfig is supportive and helps contributors avoid introducing CRLF during editing.
Proposed baseline .gitattributes content:
* text=auto eol=lf
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.pdf binary
*.zip binaryThis would make LF the default for text files in the repository. Binary files should be marked as binary so Git does not attempt end-of-line normalization.
If normalization is performed, the resulting PRs should contain only line-ending related changes. Reviewers should be informed that these are non-functional changes and may want to use whitespace-insensitive diff views.