mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-13 12:30:08 -06:00
Merge pull request #333 from bchess/include_symlinks
include checking symlinks
This commit is contained in:
@@ -89,7 +89,7 @@ def get_files_matching(all_file_list_strategy):
|
||||
if (
|
||||
include_regex.search(filename) and
|
||||
not exclude_regex.search(filename) and
|
||||
os.path.exists(filename)
|
||||
os.path.lexists(filename)
|
||||
)
|
||||
)
|
||||
return wrapper
|
||||
|
||||
1
testing/test_symlink
Symbolic link
1
testing/test_symlink
Symbolic link
@@ -0,0 +1 @@
|
||||
does_not_exist
|
||||
@@ -61,6 +61,7 @@ def get_files_matching_func():
|
||||
'pre_commit/main.py',
|
||||
'pre_commit/git.py',
|
||||
'im_a_file_that_doesnt_exist.py',
|
||||
'testing/test_symlink',
|
||||
'hooks.yaml',
|
||||
)
|
||||
|
||||
@@ -73,6 +74,7 @@ def test_get_files_matching_base(get_files_matching_func):
|
||||
'pre_commit/main.py',
|
||||
'pre_commit/git.py',
|
||||
'hooks.yaml',
|
||||
'testing/test_symlink'
|
||||
])
|
||||
|
||||
|
||||
@@ -96,7 +98,7 @@ def test_does_not_include_deleted_fileS(get_files_matching_func):
|
||||
|
||||
def test_exclude_removes_files(get_files_matching_func):
|
||||
ret = get_files_matching_func('', '\\.py$')
|
||||
assert ret == set(['hooks.yaml'])
|
||||
assert ret == set(['hooks.yaml', 'testing/test_symlink'])
|
||||
|
||||
|
||||
def resolve_conflict():
|
||||
|
||||
Reference in New Issue
Block a user