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

Prevent line ending conversion in repos #333

Merged

Conversation

makubacki
Copy link
Member

@makubacki makubacki commented Apr 12, 2024

Unsets the text attribute on all files to prevent their line endings
from being normalized.

See https://git-scm.com/docs/gitattributes for background.

This was previously accomplished solely by instructing users to set
core.autocrlf to false. However, that does not translate to pipelines
and setting in a pipeline requires the system level git configuration
to be modified prior to checkout. Git configs cannot be checked into
to a repo and automatically used for security reasons.

This is a simple way to check the change into the repo so it applies
for all users including pipelines to prevent line ending conversion.

This allows plugins like LineEndingCheck to produce similar results
in pipelines on Linux and Windows agents.

@makubacki makubacki added the type:feature-request A new feature proposal label Apr 12, 2024
@makubacki makubacki requested review from os-d and apop5 April 12, 2024 01:49
@makubacki makubacki self-assigned this Apr 12, 2024
@makubacki
Copy link
Member Author

makubacki commented Apr 12, 2024

Tested in the following mu_basecore Windows agent pipeline runs:

@makubacki
Copy link
Member Author

On hold to let this PR verify there's no unexpected impact before rolling out to other repos.

microsoft/mu_basecore#809

@makubacki
Copy link
Member Author

On hold to let this PR verify there's no unexpected impact before rolling out to other repos.

microsoft/mu_basecore#809

No negative consequences seen from that PR, so I'm going to merge this PR now.

Unsets the text attribute on all files to prevent their line endings
from being normalized.

See https://git-scm.com/docs/gitattributes for background.

This was previously accomplished solely by instructing users to set
core.autocrlf to false. However, that does not trasnlate to pipelines
and setting in a pipeline requires the system level git configuration
to be modified prior to checkout. Git configs cannot be checked into
to a repo and automatically used for security reasons.

This is a simple way to check the change into the repo so it applies
for all users including pipelines to prevent line ending conversion.

This allows plugins like LineEndingCheck to produce similar results
in pipelines on Linux and Windows agents.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki force-pushed the add_gitattr_no_text_le_conversion branch from fa373f1 to 3d937ea Compare May 14, 2024 01:51
@makubacki makubacki merged commit 1c0d6f1 into microsoft:main May 14, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature-request A new feature proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants