fix(cli): ignore generated folders by default
- Skip .comments, virtualenvs, env files, VCS folders, and OS metadata in sync. - Apply defaults before project .nanoshareignore and repeatable --ignore rules. - Cover default ignores for local uploads and direct pattern matching.
This commit is contained in:
@@ -4,9 +4,29 @@ from fnmatch import fnmatch
|
||||
from pathlib import Path
|
||||
|
||||
IGNORE_FILE_NAME = '.nanoshareignore'
|
||||
DEFAULT_IGNORE_PATTERNS = [
|
||||
IGNORE_FILE_NAME,
|
||||
'.comments/',
|
||||
'.env',
|
||||
'.env.*',
|
||||
'.venv/',
|
||||
'venv/',
|
||||
'__pycache__/',
|
||||
'.pytest_cache/',
|
||||
'.mypy_cache/',
|
||||
'.ruff_cache/',
|
||||
'.git/',
|
||||
'.hg/',
|
||||
'.svn/',
|
||||
'.DS_Store',
|
||||
'Thumbs.db',
|
||||
'desktop.ini',
|
||||
'$RECYCLE.BIN/',
|
||||
'System Volume Information/',
|
||||
]
|
||||
|
||||
def load_ignore_patterns(root: Path, extra_patterns: list[str] | None = None) -> list[str]:
|
||||
patterns = [IGNORE_FILE_NAME]
|
||||
patterns = list(DEFAULT_IGNORE_PATTERNS)
|
||||
ignore_file = root / IGNORE_FILE_NAME
|
||||
if ignore_file.is_file():
|
||||
for line in ignore_file.read_text().splitlines():
|
||||
|
||||
Reference in New Issue
Block a user