Skip to content

Commit

Permalink
filter .git directories, but not x.git ones
Browse files Browse the repository at this point in the history
This fix conda#1655
  • Loading branch information
dfroger committed Jan 13, 2017
1 parent 8ea04be commit c32fa1b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion conda_build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def warn_on_old_conda_build(index=None, installed_version=None, available_packag
""" % (installed_version, available_packages[-1]), file=sys.stderr)


def filter_files(files_list, prefix, filter_patterns=('.*[\\\\/]?\.git[\\\\/].*', )):
def filter_files(files_list, prefix, filter_patterns=('(.*[\\\\/])?\.git[\\\\/].*', )):
"""Remove things like .git from the list of files to be copied"""
for pattern in filter_patterns:
r = re.compile(pattern)
Expand Down
12 changes: 10 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,13 @@ def test_create_info_files_json_no_inodes(testing_workdir, test_metadata):


def test_filter_files():
files_list = ['a', '.git/a', 'something/.git/a', '.git\\a', 'something\\.git\\a']
assert build.filter_files(files_list, '') == ['a']
# Files that should be filter out.
files_list = ['.git/a', 'something/.git/a', '.git\\a', 'something\\.git\\a']
assert not build.filter_files(files_list, '')

# Files that should *not* be filter out.
# Example of valid 'x.git' directory:
# lib/python3.4/site-packages/craftr/stl/craftr.utils.git/Craftrfile
files_list = ['a', 'x.git/a', 'something/x.git/a',
'x.git\\a', 'something\\x.git\\a']
assert len(build.filter_files(files_list, '')) == len(files_list)

0 comments on commit c32fa1b

Please sign in to comment.