-
Notifications
You must be signed in to change notification settings - Fork 179
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
[feature] Added support for negative alt condition #522
Conversation
Hi and thanks for your contribution! This has been requested before (see #365) and I would like to get this merged. But first a few things that would be good if you could look into:
|
Thanks for the quick response!
|
Another thing I started thinking about is if the number of negated conditions should contribute to the score in the same way as the number of conditions does today? I.e. should e.g. |
Thanks for the comments, pushed updated the code.
That's a good point, I don't really have a strong opinion. I think only adding 1000 for non-negated conditions makes sense. I can't really think of any examples that would be counter-intuitive. I've updated the logic/tests. Also for the weight documentation, is there another way to determine which alt files will be used? Like getting started with yadm, it was unclear to me which file would be chosen when multiple files had the same number of valid conditions without running |
I was going to say that we could document the relative weights, but when I checked it was already there. From yadm.1:
Could it be that this is enough, or could it be made clearer in some way? |
Hm yeah, I think it's clear to me now. Maybe just didn't read through the docs enough the first time around. And I updated the docs for negated conditions and fixed the mistake you pointed out. |
This has now been merged to develop. Thanks for your contribution! |
What does this PR do?
Adds negative conditions to alt resolution. For instance, if
local.class=test
,file##!c.test
is an invalid condition. This is useful for me where I want to disable a file on a specific computer.What issues does this PR fix or reference?
I didn't make an issue, should I?
Previous Behavior
This is a new feature. Before, there was no way (that I know) to accomplish a negative condition.
New Behavior
See test case and comments below. Basically, it's possible to avoid using a specific file if a given condition is met if prefixed with
!
.Have tests been written for this change?
Yes
Have these commits been signed with GnuPG?
No
Please review yadm's Contributing Guide for best practices.