mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-02-08 07:28:45 +00:00
ignores .git now
This commit is contained in:
@@ -58,3 +58,15 @@ class DrawingsPathlibTests(TestCase):
|
|||||||
drawings.load_drawings_files()
|
drawings.load_drawings_files()
|
||||||
|
|
||||||
self.assertTrue(DrawingFile.objects.filter(dwgpath='noext').exists())
|
self.assertTrue(DrawingFile.objects.filter(dwgpath='noext').exists())
|
||||||
|
|
||||||
|
def test_git_dir_skipped(self):
|
||||||
|
with tempfile.TemporaryDirectory() as td:
|
||||||
|
p = pathlib.Path(td)
|
||||||
|
g = p / '.git'
|
||||||
|
g.mkdir()
|
||||||
|
(g / 'secret.txt').write_text('top secret')
|
||||||
|
settings.DRAWINGS_DATA = td
|
||||||
|
|
||||||
|
drawings.load_drawings_files()
|
||||||
|
|
||||||
|
self.assertFalse(DrawingFile.objects.filter(dwgpath='.git/secret.txt').exists())
|
||||||
|
|||||||
@@ -340,6 +340,9 @@ def load_drawings_files():
|
|||||||
|
|
||||||
# Walk the tree with pathlib, skip hidden and backup files
|
# Walk the tree with pathlib, skip hidden and backup files
|
||||||
for p in drawdatadir.rglob('*'):
|
for p in drawdatadir.rglob('*'):
|
||||||
|
# Ignore anything under a .git directory
|
||||||
|
if '.git' in p.parts:
|
||||||
|
continue
|
||||||
if p.name.startswith('.') or p.name.endswith('~'):
|
if p.name.startswith('.') or p.name.endswith('~'):
|
||||||
continue
|
continue
|
||||||
if p.is_dir():
|
if p.is_dir():
|
||||||
|
|||||||
Reference in New Issue
Block a user