feat: use .gitignore
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
from pathlib import Path
|
||||
|
||||
from pathspec import PathSpec
|
||||
|
||||
DEFAULT_IGNORE = [
|
||||
".git",
|
||||
"node_modules",
|
||||
".venv",
|
||||
"__pycache__",
|
||||
]
|
||||
|
||||
|
||||
def create_ignore(basepath: Path) -> PathSpec:
|
||||
lines = DEFAULT_IGNORE.copy()
|
||||
gitignore = basepath / ".gitignore"
|
||||
if gitignore.exists():
|
||||
with open(gitignore, "r") as fd:
|
||||
lines += fd.readlines()
|
||||
return PathSpec.from_lines("gitignore", lines)
|
||||
Reference in New Issue
Block a user