X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/e269f44b25737360e0dc65379f889dfa931dc68a..afed2c01903465f9a486ac481a66aa3413cc1b01:/src/black/__init__.py?ds=inline diff --git a/src/black/__init__.py b/src/black/__init__.py index afc76e1..117dc83 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -623,12 +623,7 @@ def get_sources( ) -> Set[Path]: """Compute the set of files to be formatted.""" sources: Set[Path] = set() - - if exclude is None: - exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES) - gitignore = get_gitignore(ctx.obj["root"]) - else: - gitignore = None + root = ctx.obj["root"] for s in src: if s == "-" and stdin_filename: @@ -663,6 +658,11 @@ def get_sources( sources.add(p) elif p.is_dir(): + if exclude is None: + exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES) + gitignore = get_gitignore(root) + else: + gitignore = None sources.update( gen_python_files( p.iterdir(),