RFR: 8267892: Add .gitattributes to repo

Kevin Rushforth kcr at openjdk.java.net
Thu May 27 22:20:23 UTC 2021


This fix adds a `.gitattributes` file to prevent git from replacing line endings if the global `.gitconfig` file on the client system is configured with core.autocrlf = true (which it is by default when using the native Git for Windows).

This can cause build or test problems with scripts or other files that expect Unix-style line endings. For two recent examples of such problems, see [JDK-8267694](https://bugs.openjdk.java.net/browse/JDK-8267694) and [this comment in PR #518](https://github.com/openjdk/jfx/pull/518#issuecomment-849966053).

To test this, I set `core.autocrlf = true` in my `$HOME/.gitconfig` and cloned the master branch of the jfx repo into a new local repo. The files all had CRLF line endings. I then cloned the branch with the fix for this PR into a new repo and verified that the line endings are correctly left alone (LF line endings).

As a second test, here is a failing GHA build of the patch from PR #518 that fails as expected due to this bug:

https://github.com/kevinrushforth/jfx/actions/runs/883603338

Here is a GHA build of that same branch, plus the commit to add `.gitattributes`:

https://github.com/kevinrushforth/jfx/actions/runs/883620592

-------------

Commit messages:
 - 8267892: Add .gitattributes to repo

Changes: https://git.openjdk.java.net/jfx/pull/523/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=523&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8267892
  Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jfx/pull/523.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/523/head:pull/523

PR: https://git.openjdk.java.net/jfx/pull/523


More information about the openjfx-dev mailing list