Skip to content

Commit

Permalink
Add .gitattributes file (#1487)
Browse files Browse the repository at this point in the history
## Describe your changes
Add a .gitattributes file with `* text=auto` so that file endings are
automatically handled by git and overrides the user settings.

Otherwise, if a user hasn't set `git config core.autocrlf` a file saved
on Windows uses CRLF endings. This shows up as the whole file being
changed.
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

## Checklist before requesting a review
- [ ] Add unit tests for this change.
- [ ] Make sure all tests can pass.
- [ ] Update documents if necessary.
- [ ] Lint and apply fixes to your code by running `lintrunner -a`
- [ ] Is this a user-facing change? If yes, give a description of this
change to be included in the release notes.
- [ ] Is this PR including examples changes? If yes, please remember to
update [example
documentation](https://github.com/microsoft/Olive/blob/main/docs/source/examples.md)
in a follow-up PR.

## (Optional) Issue link
  • Loading branch information
jambayk authored Nov 14, 2024
1 parent 52af325 commit bb39cd9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Windows specific files should retain windows line-endings
*.ps1 text eol=crlf

# make sure .sh retains Unix line endings, even when checked out on windows.
*.sh text eol=lf

0 comments on commit bb39cd9

Please sign in to comment.