Compare commits
2 Commits
d3c914285c
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
d3e5e11f8d
|
|||
|
08d0d154c9
|
@@ -46,6 +46,8 @@ def is_ignored(rel_path: str, patterns: list[str]) -> bool:
|
|||||||
if pattern.endswith('/'):
|
if pattern.endswith('/'):
|
||||||
if path == normalized or path.startswith(f'{normalized}/'):
|
if path == normalized or path.startswith(f'{normalized}/'):
|
||||||
return True
|
return True
|
||||||
|
if any(fnmatch(part, normalized) for part in parts):
|
||||||
|
return True
|
||||||
continue
|
continue
|
||||||
if '/' in normalized:
|
if '/' in normalized:
|
||||||
if fnmatch(path, normalized):
|
if fnmatch(path, normalized):
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ def _remote_events_thread(args, flag: _ChangeFlag, stop: threading.Event) -> thr
|
|||||||
flag.notify()
|
flag.notify()
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
if not stop.is_set():
|
if not stop.is_set():
|
||||||
print(f'remote event stream unavailable; retrying in 30s: {exc}', file=sys.stderr)
|
print(f'remote event stream disconnected; retrying in 30s: {exc}', file=sys.stderr)
|
||||||
stop.wait(30)
|
stop.wait(30)
|
||||||
finally:
|
finally:
|
||||||
if client:
|
if client:
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nanoshare-cli"
|
name = "nanoshare-cli"
|
||||||
version = "0.4.0"
|
version = "0.4.2"
|
||||||
description = "NanoShare desktop CLI and folder sync client"
|
description = "NanoShare desktop CLI and folder sync client"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.11"
|
requires-python = ">=3.11"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "nanoshare"
|
name = "nanoshare"
|
||||||
version = "1.25.0"
|
version = "1.26.0"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ async def api_file_events(user: dict):
|
|||||||
previous = await _snapshot(user_id)
|
previous = await _snapshot(user_id)
|
||||||
yield 'event: ready\ndata: {}\n\n'
|
yield 'event: ready\ndata: {}\n\n'
|
||||||
while True:
|
while True:
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(15)
|
||||||
current = await _snapshot(user_id)
|
current = await _snapshot(user_id)
|
||||||
if current != previous:
|
if current != previous:
|
||||||
previous = current
|
previous = current
|
||||||
@@ -45,7 +45,9 @@ async def api_file_events(user: dict):
|
|||||||
else:
|
else:
|
||||||
yield ': keepalive\n\n'
|
yield ': keepalive\n\n'
|
||||||
|
|
||||||
return Response(stream(), content_type='text/event-stream', headers={
|
response = Response(stream(), content_type='text/event-stream', headers={
|
||||||
'Cache-Control': 'no-cache',
|
'Cache-Control': 'no-cache',
|
||||||
'X-Accel-Buffering': 'no',
|
'X-Accel-Buffering': 'no',
|
||||||
})
|
})
|
||||||
|
response.timeout = None
|
||||||
|
return response
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ def test_sync_ignores_local_files_from_nanoshareignore(tmp_path, monkeypatch):
|
|||||||
(tmp_path / 'scratch.tmp').write_text('ignored')
|
(tmp_path / 'scratch.tmp').write_text('ignored')
|
||||||
(tmp_path / '.comments').mkdir()
|
(tmp_path / '.comments').mkdir()
|
||||||
(tmp_path / '.comments' / 'ignored.xml').write_text('<comment />')
|
(tmp_path / '.comments' / 'ignored.xml').write_text('<comment />')
|
||||||
|
(tmp_path / 'Cerberus' / '.comments').mkdir(parents=True)
|
||||||
|
(tmp_path / 'Cerberus' / '.comments' / '76. Two-headeds.PNG.xml').write_text('<comment />')
|
||||||
(tmp_path / '.env').write_text('SECRET=ignored')
|
(tmp_path / '.env').write_text('SECRET=ignored')
|
||||||
(tmp_path / '.venv').mkdir()
|
(tmp_path / '.venv').mkdir()
|
||||||
(tmp_path / '.venv' / 'ignored.py').write_text('ignored')
|
(tmp_path / '.venv' / 'ignored.py').write_text('ignored')
|
||||||
@@ -261,6 +263,7 @@ def test_default_ignore_patterns_skip_common_generated_files(tmp_path):
|
|||||||
patterns = load_ignore_patterns(tmp_path)
|
patterns = load_ignore_patterns(tmp_path)
|
||||||
|
|
||||||
assert is_ignored('.comments/comment.xml', patterns)
|
assert is_ignored('.comments/comment.xml', patterns)
|
||||||
|
assert is_ignored('Cerberus/.comments/76. Two-headeds.PNG.xml', patterns)
|
||||||
assert is_ignored('.env', patterns)
|
assert is_ignored('.env', patterns)
|
||||||
assert is_ignored('.env.local', patterns)
|
assert is_ignored('.env.local', patterns)
|
||||||
assert is_ignored('.venv/bin/python', patterns)
|
assert is_ignored('.venv/bin/python', patterns)
|
||||||
|
|||||||
Reference in New Issue
Block a user