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

.gitattributes: Prevent line ending conversion #809

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

makubacki
Copy link
Member

@makubacki makubacki commented Apr 12, 2024

Description

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.


This commit is testing the change for a period of time in the
mu_basecore repo
.

If no issues with git operations and impact on tools is discovered
after a couple weeks, it will be synced across all repos from
mu_devops.

  • Impacts functionality?
    • Functionality - Does the change ultimately impact how firmware functions?
    • Examples: Add a new library, publish a new PPI, update an algorithm, ...
  • Impacts security?
    • Security - Does the change have a direct security impact on an application,
      flow, or firmware?
    • Examples: Crypto algorithm change, buffer overflow fix, parameter
      validation improvement, ...
  • Breaking change?
    • Breaking change - Will anyone consuming this change experience a break
      in build or boot behavior?
    • Examples: Add a new library class, move a module to a different repo, call
      a function in a new library class in a pre-existing module, ...
  • Includes tests?
    • Tests - Does the change include any explicit test code?
    • Examples: Unit tests, integration tests, robot tests, ...
  • Includes documentation?
    • Documentation - Does the change contain explicit documentation additions
      outside direct code modifications (and comments)?
    • Examples: Update readme file, add feature readme file, link to documentation
      on an a separate Web page, ...

How This Was Tested

  • Clone mu_basecore repo with the change locally and verify a new file added
    with several commits of changes appears properly in git unified diffs like
    those from git format-patch, git diff, etc.
  • Verify changes on existing files appear as expected in git history.
  • Verify pipelines with the change properly preserve line endings so line ending
    checks (LineEndingCheck plugin) are consistent across agents.

Tested in the following mu_basecore Windows agent pipeline runs:

Tested in the following mu_basecore Linux agent pipeline runs:

Integration Instructions

N/A

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.

---

This commit is testing the change for a period of time in the
mu_basecore repo. If no issues with git operations and impact on tools
is discovered after a couple weeks, it will be synced across all
repos from mu_devops.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
@makubacki makubacki added the semver:patch Pull requests that should increment the release patch version label Apr 12, 2024
@makubacki makubacki self-assigned this Apr 12, 2024
@github-actions github-actions bot added the impact:non-functional Does not have a functional impact label Apr 12, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 1.22%. Comparing base (291b637) to head (44426d9).

Additional details and impacted files
@@               Coverage Diff               @@
##           release/202311     #809   +/-   ##
===============================================
  Coverage            1.22%    1.22%           
===============================================
  Files                1303     1303           
  Lines              335757   335757           
  Branches             3183     3183           
===============================================
  Hits                 4118     4118           
  Misses             331563   331563           
  Partials               76       76           
Flag Coverage Δ
MdeModulePkg 0.68% <ø> (ø)
MdePkg 5.37% <ø> (ø)
NetworkPkg 0.00% <ø> (ø)
PolicyServicePkg 30.41% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@makubacki makubacki merged commit e2ef21d into microsoft:release/202311 Apr 12, 2024
36 checks passed
ProjectMuBot referenced this pull request in microsoft/mu_tiano_platforms Apr 23, 2024
Introduces 11 new commits in [MU_BASECORE](https://github.com/microsoft/mu_basecore.git).

<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/microsoft/mu_basecore/commit/d6e01136697c1aed85bb83cff98b74ec11e96e1a">d6e011</a> CryptoPkg/BaseCryptLib: add DigestLen to RsaOaepEncrypt(), RsaOaepDecrypt() (<a href="https://github.com/microsoft/mu_basecore/pull/797">#797</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/718ec92fc526c9e30bd752bb4f4c692b7d135f60">718ec9</a> CryptoPkg/Binaries: update to 2023.11.3 (<a href="https://github.com/microsoft/mu_basecore/pull/805">#805</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/291b637f9755a6d8e564c2481b6fcfd07d84c391">291b63</a> Add ARM and AARCH64 MSCVC Support to StackCheckLib (<a href="https://github.com/microsoft/mu_basecore/pull/808">#808</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/e2ef21d778bdd8299d45caa08a64edc71dee3582">e2ef21</a> .gitattributes: Prevent line ending conversion (<a href="https://github.com/microsoft/mu_basecore/pull/809">#809</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/b28d62e01b0623cbe1081ce782e2d965bdd85c77">b28d62</a> DscCompleteCheck: Bugfix ignorepaths config option (<a href="https://github.com/microsoft/mu_basecore/pull/806">#806</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/8c89cc65215b7cc54cb6f3649498f4e8305c5d76">8c89cc</a> Repo File Sync: Update to Mu DevOps 9.1.9 and Rust 1.76.0 (<a href="https://github.com/microsoft/mu_basecore/pull/804">#804</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/24d560145920c6159c43549fadaf13e9eeb84566">24d560</a> Repo File Sync: Update to Ubuntu Container 0e124c1 (<a href="https://github.com/microsoft/mu_basecore/pull/810">#810</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/f5c010f870a163d5183bdf5afb09888816c30496">f5c010</a> GitHub Action: Bump robinraju/release-downloader from 1.9 to 1.10 (<a href="https://github.com/microsoft/mu_basecore/pull/811">#811</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/bb4782415704b5e52eb1aab9f3d8433ac209da50">bb4782</a> Repo File Sync: synced file(s) with microsoft/mu_devops (<a href="https://github.com/microsoft/mu_basecore/pull/812">#812</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/39887536b1ab19146cac58e477abed2ff03926eb">398875</a> [CHERRY-PICK] MdePkg/SmBios.h: Add New ProcessorFamily definitions for SMBIOS Type4 (<a href="https://github.com/microsoft/mu_basecore/pull/813">#813</a>)</li>
<li><a href="https://github.com/microsoft/mu_basecore/commit/6e49e97ccb142d7a350f91a85588350702a34eeb">6e49e9</a> GitHub Action: Bump robinraju/release-downloader from 1.9 to 1.10 (<a href="https://github.com/microsoft/mu_basecore/pull/817">#817</a>)</li>
</ul>
</details>

Signed-off-by: Project Mu Bot <mubot@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
impact:non-functional Does not have a functional impact semver:patch Pull requests that should increment the release patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants