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.
This commit is contained in:
Łukasz Langa 2018-05-31 19:47:24 -07:00
parent 8a82e0bf9a
commit a80e037a9a

View File

@ -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,