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

fix: skip excluded paths before rendering #1440

Merged
merged 1 commit into from
Nov 29, 2023

Conversation

sisp
Copy link
Member

@sisp sisp commented Nov 29, 2023

I've fixed a bug related to skipping excluded files, which may even contain malformed Jinja syntax. Before, Copier determined whether a file is skipped after rendering it, which failed when the file contained malformed template syntax. Since the file should have been skipped, rendering should not have been attempted at all, so even malformed template syntax should not have mattered. Now, skipping excluded files happens before a rendering attempt, so even malformed template syntax in excluded files is allowed.

This problem came up in a slightly different scenario where copier.yml contained _envops settings with Jinja statement markers, _templates_suffix: "", and no subdirectory was configured, so that copier.yml was attempted to be rendered before the exclusion logic would have ignored it, which led to the reported problem in #1410. But it turned out that the root cause was more fundamental, which I've been able to fix with a simple change.

Fixes #1410.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d0c9011) 97.30% compared to head (d858282) 97.46%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1440      +/-   ##
==========================================
+ Coverage   97.30%   97.46%   +0.16%     
==========================================
  Files          48       48              
  Lines        4520     4531      +11     
==========================================
+ Hits         4398     4416      +18     
+ Misses        122      115       -7     
Flag Coverage Δ
unittests 97.46% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sisp sisp force-pushed the fix/exclude-without-templates-suffix branch from 389c2e9 to 18b366f Compare November 29, 2023 14:15
Copy link
Contributor

@pawamoy pawamoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@sisp sisp force-pushed the fix/exclude-without-templates-suffix branch from 18b366f to d858282 Compare November 29, 2023 17:25
@yajo yajo merged commit 8383bc9 into copier-org:master Nov 29, 2023
21 checks passed
@sisp sisp deleted the fix/exclude-without-templates-suffix branch November 30, 2023 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom block_start_string (and others) in _envops fail if empty _templates_suffix used.
3 participants