]> git.madduck.net Git - etc/vim.git/commit

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Fix false symlink detection claims in verbose output (#3385)
authorAntonio Ossa-Guerra <aaossa@uc.cl>
Thu, 19 Jan 2023 02:38:27 +0000 (23:38 -0300)
committerGitHub <noreply@github.com>
Thu, 19 Jan 2023 02:38:27 +0000 (21:38 -0500)
commit18fb88486d434dbde9b2a9c98f008a71cf5d941d
treea8ddbb594a9780e95021c1a5d96feb8b09bfdaf7
parent7e6d3fac197395b0a2b380cc60811536fe23626b
Fix false symlink detection claims in verbose output (#3385)

When trying to format a project from the outside, the verbose output
shows says that there are symbolic links that points outside of the
project, but displays the wrong project path, meaning that these
messages are false positives.

This bug is triggered when the command is executed from outside a
project on a folder inside it, causing an inconsistency between the
path to the detected project root and the relative path to the target
contents.

The fix is to normalize the target path using the project root before
processing the sources, which removes the presence of the incorrect
messages.

---

The test attemps to emulate the behavior of the CLI as closely as
posible by patching some `pathlib.Path` methods and passing certain
reference paths to the context object and `black.get_sources`.

Before the associated fix was introduced, this test failed because
some of the captured files reported the presence of a symlink due to
an incorrectly formated path. The test also asserts that only a single
file is reported as ignored, which is part of the expected behavior.

Signed-off-by: Antonio Ossa Guerra <aaossa@uc.cl>
CHANGES.md
src/black/__init__.py
tests/test_black.py