summaryrefslogtreecommitdiff
path: root/coverage/html.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-10-27 18:57:56 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-10-27 19:03:31 -0400
commitea6906b092d9bb09285094eee94e322d2cb413a5 (patch)
treed85cdf4f7907f4ded12a2b1d61cc09cb97debae2 /coverage/html.py
parent7fd1ea39925f0856ff607bb30796bc948a8c829d (diff)
downloadpython-coveragepy-git-ea6906b092d9bb09285094eee94e322d2cb413a5.tar.gz
feat: html output directory gets a .gitignore file. #1244
Diffstat (limited to 'coverage/html.py')
-rw-r--r--coverage/html.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/coverage/html.py b/coverage/html.py
index 6246a9b9..52689050 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -224,6 +224,11 @@ class HtmlReporter:
for static in self.STATIC_FILES:
shutil.copyfile(data_filename(static), os.path.join(self.directory, static))
+ # .gitignore can't be copied from the source tree because it would
+ # prevent the static files from being checked in.
+ with open(os.path.join(self.directory, ".gitignore"), "w") as fgi:
+ fgi.write("# Created by coverage.py\n*\n")
+
# The user may have extra CSS they want copied.
if self.extra_css:
shutil.copyfile(self.config.extra_css, os.path.join(self.directory, self.extra_css))