Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Fix ignore and add exclude support in layer.yaml #235
Conversation
|
Note: To make the |
mbruzek
reviewed
Jul 18, 2016
| + """ | ||
| + for candidate in next_config.tactics + DEFAULT_TACTICS: | ||
| + if candidate.trigger(entity, target, layer, next_config): | ||
| + tactic = candidate(entity, target, layer, next_config) |
mbruzek
Jul 18, 2016
•
Contributor
You don't check if tactic is None here. Are you sure tactic can never be None?
johnsca
Jul 18, 2016
Member
candidate is a class not a function, so it is guaranteed to return an instance (this is basically like IgnoreTactic(entity, target, layer, next_config)).
|
@johnsca we discussed the two ways charm-tools currently excluded files. I don't see the removal of the existing ignore code. Did I miss it somewhere in here? |
mbruzek
reviewed
Jul 18, 2016
| - if tactic.trigger(entity.relpath(bd)): | ||
| - return tactic(target=target, entity=entity, | ||
| - current=current, config=next_config) | ||
| - return None |
mbruzek
reviewed
Jul 18, 2016
| @@ -475,8 +476,7 @@ def validate(self): | ||
| if not self.manifest.exists(): | ||
| return [], [], [] | ||
| - ignorer = utils.ignore_matcher(DEFAULT_IGNORES) |
|
I have reviewed this code and it looks sound to me. +1 |
|
Why an ignore tactic at all? In the BulidConfig.tactic method you could return None if the current entity is in the excludes list which won't include a tactic at all. This would be almost identical to the handling of the ignore list there which returns None if next layer would ignore this file. Its is very possible I am missing something, but at a glance
seems simpler Here I include the default ignore list as well, but really that is just saying by default we don't expect our .git/.bzr stuff to make it into the output. |
|
@bcsaller This actually came up with Issue #234 where I was able to find a case where the Using a debugger I was able to find many cases where both I added a check for |
|
I might be misunderstanding something. I mean that if tactic() returns None On Mon, Jul 18, 2016 at 9:38 AM Matt Bruzek notifications@github.com
|
|
@bcsaller Your suggestion is pretty much identical to the existing implementation which suffers from both bugs. We don't want Your suggestion also doesn't address the issue that ignores (and also now excludes) would be propagated up through any layer that doesn't specify a value, though that only requires the new implementations of the ignore and excludes properties. The main reason I went with This is by no means the smallest nor least invasive change that could have addressed these issues, but it seemed like a reasonable refactor. However, it does change the signature of the |
|
btw, the |
|
Commit updated to include |
|
This makes more sense now, thanks for the explanation. |
This was referenced Jul 19, 2016
|
Rebased to master. Would like to get this merged and included with the next release. |
|
Not sure how this one missed the |
johnsca commentedJul 17, 2016
Description of change
Checklist
make test?Fixes #220 by making ignore apply only to the files provided by layers lower than the one currently being processed, and by adding an exclude counterpart which applies only to the current layer.
Fixes #234 by refactoring ignore support and making it an error for no tactics to match a file (there should always be a fall-back, such as CopyTactic).