Merge pull request #8466 from nextcloud/Rello-codex/exclude-----from-ignore-list-evaluation

ignore list evaluation
This commit is contained in:
Matthieu Gallien 2025-07-18 09:23:58 +02:00 committed by GitHub
commit fe8923ccd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -257,6 +257,11 @@ void ExcludedFiles::addManualExclude(const QString &expr, const QString &basePat
{
Q_ASSERT(basePath.endsWith(QLatin1Char('/')));
const auto trimmedExpr = QStringView{expr}.trimmed();
if (trimmedExpr == QLatin1String("*")) {
return;
}
auto key = basePath;
_manualExcludes[key].append(expr);
_allExcludes[key].append(expr);
@ -291,6 +296,10 @@ void ExcludedFiles::loadExcludeFilePatterns(const QString &basePath, QFile &file
}
if (line.isEmpty() || line.startsWith('#'))
continue;
const auto patternStr = QString::fromUtf8(line);
if (QStringView{patternStr}.trimmed() == QLatin1StringView("*")) {
continue;
}
csync_exclude_expand_escapes(line);
patterns.append(QString::fromUtf8(line));
}

View File

@ -121,9 +121,9 @@ private slots:
{
setup();
excludedFiles->addManualExclude("*", "/tmp/check_csync1/");
QCOMPARE(check_file_full("/tmp/check_csync1/foo"), CSYNC_FILE_EXCLUDE_LIST);
QCOMPARE(check_file_full("/tmp/check_csync1/foo"), CSYNC_NOT_EXCLUDED);
QCOMPARE(check_file_full("/tmp/check_csync2/foo"), CSYNC_NOT_EXCLUDED);
QVERIFY(excludedFiles->_allExcludes[QStringLiteral("/tmp/check_csync1/")].contains("*"));
QVERIFY(!excludedFiles->_allExcludes[QStringLiteral("/tmp/check_csync1/")].contains("*"));
excludedFiles->addManualExclude("foo");
QVERIFY(excludedFiles->_fullRegexFile[QStringLiteral("/")].pattern().contains("foo"));