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

Solved Problem with Non-ASCII .gitignore Files #2229

Merged
merged 12 commits into from May 24, 2021
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -4,6 +4,8 @@

### _Black_

- Fix handling of .gitignore files containing non-ASCII characters on Windows (#2229)
- Fix typos discovered by codespell (#2228)
temeddix marked this conversation as resolved.
Show resolved Hide resolved
- Respect `.gitignore` files in all levels, not only `root/.gitignore` file (apply
`.gitignore` rules like `git` does) (#2225)
- Restored compatibility with Click 8.0 on Python 3.6 when LANG=C used (#2227)
Expand Down
2 changes: 1 addition & 1 deletion src/black/files.py
Expand Up @@ -118,7 +118,7 @@ def get_gitignore(root: Path) -> PathSpec:
gitignore = root / ".gitignore"
lines: List[str] = []
if gitignore.is_file():
with gitignore.open() as gf:
with gitignore.open(encoding="utf-8") as gf:
lines = gf.readlines()
return PathSpec.from_lines("gitwildmatch", lines)

Expand Down