From: Antonio Ossa-Guerra Date: Thu, 19 Jan 2023 02:38:27 +0000 (-0300) Subject: Fix false symlink detection claims in verbose output (#3385) X-Git-Url: https://git.madduck.net/etc/vim.git/commitdiff_plain/18fb88486d434dbde9b2a9c98f008a71cf5d941d?ds=sidebyside;hp=18fb88486d434dbde9b2a9c98f008a71cf5d941d 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 ---