Skip to content

Commit

Permalink
Minor optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
ichard26 committed Aug 31, 2022
1 parent 756bec9 commit baa741b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/black/__init__.py
Expand Up @@ -652,7 +652,12 @@ def get_sources(
elif p.is_dir():
if exclude is None:
exclude = re_compile_maybe_verbose(DEFAULT_EXCLUDES)
gitignore = get_gitignore(root) + get_gitignore(p)
gitignore = get_gitignore(root)
p_gitignore = get_gitignore(p)
# No need to use p's gitignore if it is identical to root's gitignore
# (i.e. root and p point to the same directory).
if gitignore != p_gitignore:
gitignore += p_gitignore
else:
gitignore = None
sources.update(
Expand Down

0 comments on commit baa741b

Please sign in to comment.