Manager: Rename filter() -> match()
The function returns true on a pattern match, so reflect this in the name.
This commit is contained in:
+3
-3
@@ -106,7 +106,7 @@ void Dotfile::push(const std::vector<std::string>& targets)
|
|||||||
pullOrPush(SyncType::Push, targets);
|
pullOrPush(SyncType::Push, targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Dotfile::filter(const std::filesystem::directory_entry& path,
|
bool Dotfile::match(const std::filesystem::directory_entry& path,
|
||||||
const std::vector<std::string>& patterns)
|
const std::vector<std::string>& patterns)
|
||||||
{
|
{
|
||||||
std::string pathString = path.path().string();
|
std::string pathString = path.path().string();
|
||||||
@@ -490,11 +490,11 @@ void Dotfile::forEachDotfile(const std::vector<std::string>& targets, const std:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Ignore pattern check
|
// Ignore pattern check
|
||||||
if (filter(path, Config::the().ignorePatterns())) {
|
if (match(path, Config::the().ignorePatterns())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Include check
|
// Include check
|
||||||
if (!targets.empty() && !filter(path, targets)) {
|
if (!targets.empty() && !match(path, targets)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
callback(path, index++);
|
callback(path, index++);
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ public:
|
|||||||
void pull(const std::vector<std::string>& targets = {});
|
void pull(const std::vector<std::string>& targets = {});
|
||||||
void push(const std::vector<std::string>& targets = {});
|
void push(const std::vector<std::string>& targets = {});
|
||||||
|
|
||||||
bool filter(const std::filesystem::directory_entry& path,
|
bool match(const std::filesystem::directory_entry& path,
|
||||||
const std::vector<std::string>& patterns);
|
const std::vector<std::string>& patterns);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void testDotfileFilters(const std::unordered_map<std::string, bool>& tests,
|
|||||||
createTestDotfiles(fileNames, fileContents);
|
createTestDotfiles(fileNames, fileContents);
|
||||||
|
|
||||||
for (const auto& path : fileNames) {
|
for (const auto& path : fileNames) {
|
||||||
bool result = Dotfile::the().filter(std::filesystem::directory_entry { "/" + path }, testIgnorePatterns);
|
bool result = Dotfile::the().match(std::filesystem::directory_entry { "/" + path }, testIgnorePatterns);
|
||||||
EXPECT_EQ(result, tests.at(path), printf(" path = '%s'\n", path.c_str()));
|
EXPECT_EQ(result, tests.at(path), printf(" path = '%s'\n", path.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user