Skip to content

black behaves differently in duplicated directories #2141

@srittau

Description

@srittau

This came up in python/typeshed#5250 and I am a bit stumped. Using Python 3.9.4 on Debian (also tried with Ubuntu), black 21.4b0 I get two different results using two identical directories:

srittau@blitz:~/Projekte$ diff -u --recursive typeshed typeshed2
srittau@blitz:~/Projekte$ 
(.venv-3.9) srittau@blitz:~/Projekte/typeshed$ black stubs/ stdlib/ --check
All done! ✨ 🍰 ✨
1334 files would be left unchanged.
(.venv-3.9) srittau@blitz:~/Projekte/typeshed$ 
(.venv-3.9) srittau@blitz:~/Projekte/typeshed2$ black stubs/ stdlib/ --check
would reformat stdlib/logging/config.pyi
would reformat stdlib/importlib/util.pyi
would reformat stdlib/distutils/filelist.pyi
would reformat stdlib/smtpd.pyi
would reformat stdlib/_typeshed/__init__.pyi
would reformat stubs/click/click/formatting.pyi
would reformat stubs/click-spinner/click_spinner/__init__.pyi
would reformat stubs/protobuf/google/protobuf/json_format.pyi
would reformat stdlib/ftplib.pyi
would reformat stubs/redis/redis/lock.pyi
would reformat stubs/waitress/waitress/compat.pyi
would reformat stubs/protobuf/google/protobuf/descriptor.pyi
would reformat stdlib/@python2/logging/__init__.pyi
would reformat stubs/JACK-Client/jack/__init__.pyi
would reformat stdlib/asyncio/base_events.pyi
would reformat stdlib/typing.pyi
would reformat stubs/redis/redis/client.pyi
Oh no! 💥 💔 💥
17 files would be reformatted, 1317 files would be left unchanged.
(.venv-3.9) srittau@blitz:~/Projekte/typeshed2$ 

Each using the venv in the respective directory, same result when re-initializing the venv or when using a common venv and deleting the local venvs.

In the typeshed case, i.e. where running black --check passes, it also shows a diff when running black --check --diff, meaning there is an inconsistency between --diff and --diff --check. I am stumped about what is going on here, but it's quite strange. Any pointers at what could be going here or how to debug this are appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions