Skip to content

Commit

Permalink
Add cache dir .gitignore only when we create the cache dir
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Dec 23, 2019
1 parent 7f857d6 commit 90013eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,10 @@ def __init__(self, data_dir: str,
and not has_reporters)
self.fscache = fscache
self.find_module_cache = FindModuleCache(self.search_paths, self.fscache, self.options)
# add ignore-all .gitignore to cache dir if we created it
cache_dir_existed = os.path.isdir(options.cache_dir)
self.metastore = create_metastore(options)
if fscache.isdir(options.cache_dir):
if not cache_dir_existed and os.path.isdir(options.cache_dir):
gitignore = os.path.join(options.cache_dir, ".gitignore")
if not fscache.isfile(gitignore):
with open(gitignore, "w") as f:
Expand Down

0 comments on commit 90013eb

Please sign in to comment.