Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments to .conanignore #16087

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions conans/client/conf/config_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def __init__(self, conanignore_path, ignore=None):
if os.path.exists(conanignore_path):
with open(conanignore_path, 'r') as conanignore:
for line in conanignore:
line_content = line.strip()
if line_content != "":
line_content = line.split("#", maxsplit=1)[0].strip()
if line_content:
self._ignored_entries.add(line_content)
if ignore:
self._ignored_entries.update(ignore)
Expand Down
4 changes: 3 additions & 1 deletion conans/test/integration/command/config_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ def test_config_install():
def test_config_install_conanignore():
tc = TestClient()
conanignore = textwrap.dedent("""
a/*
a/* # This is a tests
b/c/*
d/*
tests/*
# Next line is commented out, so it should be ignored
# other_tests/*
""")
tc.save({
'config_folder/.conanignore': conanignore,
Expand Down