Skip to content

black ignores file in current folder if current folder is git workspace and (parent of) current folder is a symbolic link #4205

@bersbersbers

Description

@bersbersbers

Describe the bug

black incorrectly ignores a file in the current folder

To Reproduce

(.venv) C:\>dir

12/21/2023  10:19 AM    <JUNCTION>     Code [C:\ws]
...
02/02/2024  08:33 AM    <DIR>          ws

(.venv) C:\>cd Code

(.venv) C:\Code>mkdir Bug

(.venv) C:\Code>cd Bug

(.venv) C:\Code\Bug>git init
Initialized empty Git repository in C:/ws/Bug/.git/

(.venv) C:\Code\Bug>echo 1 > bug.py

(.venv) C:\Code\Bug>black --verbose bug.py
Identified `C:\ws\Bug` as project root containing a .git directory.
bug.py ignored: is a symbolic link that points outside C:\ws\Bug
No Python files are present to be formatted. Nothing to do 😴

Expected behavior
black should not ignore bug.py

Environment

black, 24.1.2.dev11+g632f44bd68 (compiled: no)
Python (CPython) 3.12.1
Windows 10 22H2

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: file collectionRelated to file collection (e.g. gitignore & cache) or file discovery and all of its configuration.T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions