Created
May 29, 2019 18:20
-
-
Save jamesob/d8a458334386ab67082956e404fb704d to your computer and use it in GitHub Desktop.
diff <(git diff --no-color 76e2cded47..703b1819) <(git diff --no-color c7cfd20a77..955c782eb7)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35c35 | |
< index 0000000000..36188f8471 | |
--- | |
> index 0000000000..c82ecaea8c | |
38c38 | |
< @@ -0,0 +1,144 @@ | |
--- | |
> @@ -0,0 +1,158 @@ | |
58a59 | |
> + settings.command_line_options["name"].push_back("val2"); | |
60,66c61,80 | |
< + util::SettingsValue single_value = GetSetting(settings, "section", "name", false, false); | |
< + util::SettingsValue list_value(util::SettingsValue::VARR); | |
< + for (const auto& item : GetListSetting(settings, "section", "name", false)) { | |
< + list_value.push_back(item); | |
< + } | |
< + BOOST_CHECK_EQUAL(single_value.write().c_str(), R"("val1")"); | |
< + BOOST_CHECK_EQUAL(list_value.write().c_str(), R"(["val1",2])"); | |
--- | |
> + | |
> + auto check_values = [&](util::Settings s, std::string single_val, std::string list_val) { | |
> + util::SettingsValue single_value = GetSetting(s, "section", "name", false, false); | |
> + util::SettingsValue list_value(util::SettingsValue::VARR); | |
> + for (const auto& item : GetListSetting(s, "section", "name", false)) { | |
> + list_value.push_back(item); | |
> + } | |
> + BOOST_CHECK_EQUAL(single_value.write().c_str(), single_val); | |
> + BOOST_CHECK_EQUAL(list_value.write().c_str(), list_val); | |
> + }; | |
> + | |
> + // The last given arg takes precedence when specified via commandline. | |
> + check_values(settings, R"("val2")", R"(["val1","val2",2])"); | |
> + | |
> + util::Settings settings2; | |
> + settings2.ro_config["section"]["name"].push_back("val2"); | |
> + settings2.ro_config["section"]["name"].push_back("val3"); | |
> + | |
> + // The first given arg takes precedence when specified via config file. | |
> + check_values(settings2, R"("val2")", R"(["val2","val3"])"); | |
184c198 | |
< index 51dd25ed1c..6846f6caee 100644 | |
--- | |
> index 8fee66d6c3..f42155ca16 100644 | |
265c279 | |
< index 0000000000..0d6cafa7e0 | |
--- | |
> index 0000000000..33af69112d | |
303c317 | |
< + fn(Source(SettingsSpan(*value)).SetConfigFile(false)); | |
--- | |
> + fn(Source(SettingsSpan(*value)).SetConfigFile(/* top_level= */ false)); | |
313c327 | |
< + fn(Source(span).SetConfigFile(true)); | |
--- | |
> + fn(Source(span).SetConfigFile(/* top_level= */ true)); | |
337c351 | |
< + // Skip settings in top-level config section if requested. | |
--- | |
> + // Ignore settings in top-level config section if requested. | |
343c357 | |
< + //! Stick with highest priority value, if already set. | |
--- | |
> + // Stick with highest priority value, keeping result if already set. | |
361c375 | |
< + bool prev_negated = false; | |
--- | |
> + bool result_complete = false; | |
364c378 | |
< + // Skip settings in top-level config section if requested. | |
--- | |
> + // Ignore settings in top-level config section if requested. | |
377c391 | |
< + if (!prev_negated || add_zombie_config_values) { | |
--- | |
> + if (!result_complete || add_zombie_config_values) { | |
388c402 | |
< + prev_negated |= source.span.negated() > 0 || source.forced; | |
--- | |
> + result_complete |= source.span.negated() > 0 || source.forced; | |
421c435 | |
< index 0000000000..318c01103c | |
--- | |
> index 0000000000..da8ed98f75 | |
460c474 | |
< +//! @param skip_negated_command_line - ignore negated values passed on command | |
--- | |
> +//! @param skip_negated_command_line - skip negated values passed on command | |
498c512 | |
< index 6925bda4ef..17a851a242 100644 | |
--- | |
> index 6925bda4ef..c40fc79873 100644 | |
515c529 | |
< + return arg.empty() || arg[0] != '-' ? arg : arg.substr(1); | |
--- | |
> + return arg.size() > 0 && arg[0] == '-' ? arg.substr(1) : arg; | |
526c540 | |
< @@ -175,91 +179,18 @@ public: | |
--- | |
> @@ -175,91 +179,19 @@ public: | |
622c636,637 | |
< + return GetSetting(am.m_settings, no_network ? "" : am.m_network, SettingName(arg), !UseDefaultSection(am, arg), skip_negated_command_line); | |
--- | |
> + return GetSetting(am.m_settings, no_network ? "" : am.m_network, SettingName(arg), !UseDefaultSection(am, arg), | |
> + skip_negated_command_line); | |
626c641 | |
< @@ -284,20 +215,17 @@ public: | |
--- | |
> @@ -284,20 +216,17 @@ public: | |
654c669 | |
< @@ -337,22 +265,9 @@ const std::set<std::string> ArgsManager::GetUnsuitableSectionOnlyArgs() const | |
--- | |
> @@ -337,22 +266,9 @@ const std::set<std::string> ArgsManager::GetUnsuitableSectionOnlyArgs() const | |
680c695 | |
< @@ -381,7 +296,7 @@ void ArgsManager::SelectConfigNetwork(const std::string& network) | |
--- | |
> @@ -381,7 +297,7 @@ void ArgsManager::SelectConfigNetwork(const std::string& network) | |
689c704 | |
< @@ -405,116 +320,91 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin | |
--- | |
> @@ -405,116 +321,91 @@ bool ArgsManager::ParseParameters(int argc, const char* const argv[], std::strin | |
844c859 | |
< @@ -536,7 +426,7 @@ bool ArgsManager::SoftSetBoolArg(const std::string& strArg, bool fValue) | |
--- | |
> @@ -536,7 +427,7 @@ bool ArgsManager::SoftSetBoolArg(const std::string& strArg, bool fValue) | |
853c868 | |
< @@ -846,13 +736,14 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& file | |
--- | |
> @@ -846,13 +737,14 @@ bool ArgsManager::ReadConfigStream(std::istream& stream, const std::string& file | |
872c887 | |
< @@ -872,7 +763,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
--- | |
> @@ -872,7 +764,7 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
881c896 | |
< @@ -889,25 +780,31 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
--- | |
> @@ -889,25 +781,31 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
927c942 | |
< @@ -923,15 +820,14 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
--- | |
> @@ -923,15 +821,14 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
947c962 | |
< @@ -951,9 +847,13 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) | |
--- | |
> @@ -951,9 +848,13 @@ bool ArgsManager::ReadConfigFiles(std::string& error, bool ignore_invalid_keys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment