20 lines
420 B
Python
20 lines
420 B
Python
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)
|