Fix multimatch behavior to match what we have on v2

This commit is contained in:
Felipe Zimmerle 2018-10-10 18:01:48 -03:00
parent 11ebd17b9d
commit 0961760c71
No known key found for this signature in database
GPG Key ID: E6DFB08CE8B11277

View File

@ -396,10 +396,10 @@ std::list<std::pair<std::shared_ptr<std::string>,
if (m_containsMultiMatchAction == true) { if (m_containsMultiMatchAction == true) {
ret.push_back(std::make_pair( ret.push_back(std::make_pair(
std::shared_ptr<std::string>(value), std::shared_ptr<std::string>(new std::string(*value)),
std::shared_ptr<std::string>(new std::string(path)))); std::shared_ptr<std::string>(new std::string(path))));
ret.push_back(std::make_pair( ret.push_back(std::make_pair(
std::shared_ptr<std::string>(value), std::shared_ptr<std::string>(new std::string(*value)),
std::shared_ptr<std::string>(new std::string(path)))); std::shared_ptr<std::string>(new std::string(path))));
} }
@ -461,20 +461,18 @@ std::list<std::pair<std::shared_ptr<std::string>,
} }
if (m_containsMultiMatchAction == true) { if (m_containsMultiMatchAction == true) {
// v2 checks the last entry twice. Don't know why.
ret.push_back(ret.back());
#ifndef NO_LOGS #ifndef NO_LOGS
trans->debug(9, "multiMatch is enabled. " \ trans->debug(9, "multiMatch is enabled. " \
+ std::to_string(ret.size()) + \ + std::to_string(ret.size()) + \
" values to be tested."); " values to be tested.");
#endif #endif
} else {
ret.push_back(std::make_pair(
value,
std::shared_ptr<std::string>(new std::string(path))));
} }
ret.push_back(std::make_pair(
std::shared_ptr<std::string>(new std::string(*value)),
std::shared_ptr<std::string>(new std::string(path))));
return ret; return ret;
} }