mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2026-01-18 16:42:48 +00:00
ignores .git now
This commit is contained in:
@@ -58,3 +58,15 @@ class DrawingsPathlibTests(TestCase):
|
||||
drawings.load_drawings_files()
|
||||
|
||||
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
|
||||
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('~'):
|
||||
continue
|
||||
if p.is_dir():
|
||||
|
||||
Reference in New Issue
Block a user