From a80e037a9ad5867371d8df0cc8cc9c7520ccc020 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Langa?= Date: Thu, 31 May 2018 19:47:24 -0700 Subject: [PATCH] Don't over-eagerly make a path absolute if only one passed If a directory or more than one file is passed, Black nicely shows the relative paths in output. Before this change, it showed an absolute path if only a single file was passed as an argument. This fixes the inconsistency. --- black.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/black.py b/black.py index 8ac6d87..da00525 100644 --- a/black.py +++ b/black.py @@ -342,8 +342,8 @@ def reformat_one( cache: Cache = {} if write_back != WriteBack.DIFF: cache = read_cache(line_length, mode) - src = src.resolve() - if src in cache and cache[src] == get_cache_info(src): + res_src = src.resolve() + if res_src in cache and cache[res_src] == get_cache_info(res_src): changed = Changed.CACHED if changed is not Changed.CACHED and format_file_in_place( src, -- 2.39.5