From 0ccba7edfbabeb37d996e8a391aec5f756390239 Mon Sep 17 00:00:00 2001 From: Rello Date: Thu, 3 Jul 2025 14:12:51 +0200 Subject: [PATCH 1/3] fix(ignore-list): skip star pattern Signed-off-by: Rello --- src/csync/csync_exclude.cpp | 11 ++++++++++- test/testexcludedfiles.cpp | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index 37ec120072..abf63547af 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -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,8 +296,12 @@ void ExcludedFiles::loadExcludeFilePatterns(const QString &basePath, QFile &file } if (line.isEmpty() || line.startsWith('#')) continue; + QString patternStr = QString::fromUtf8(line); + if (QStringView{patternStr}.trimmed() == QLatin1String("*")) + continue; csync_exclude_expand_escapes(line); - patterns.append(QString::fromUtf8(line)); + patternStr = QString::fromUtf8(line); + patterns.append(patternStr); } _allExcludes[basePath].append(patterns); diff --git a/test/testexcludedfiles.cpp b/test/testexcludedfiles.cpp index b6c85b466b..988b4f8f54 100644 --- a/test/testexcludedfiles.cpp +++ b/test/testexcludedfiles.cpp @@ -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")); From 5f57734e87a1013dd3da9a3fddbee90dd395717a Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 16 Jul 2025 18:42:49 +0200 Subject: [PATCH 2/3] fix: use proper type of string view Signed-off-by: Matthieu Gallien --- src/csync/csync_exclude.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index abf63547af..d8b8063e43 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -296,9 +296,10 @@ void ExcludedFiles::loadExcludeFilePatterns(const QString &basePath, QFile &file } if (line.isEmpty() || line.startsWith('#')) continue; - QString patternStr = QString::fromUtf8(line); - if (QStringView{patternStr}.trimmed() == QLatin1String("*")) + const auto patternStr = QString::fromUtf8(line); + if (QStringView{patternStr}.trimmed() == QLatin1StringView("*")) { continue; + } csync_exclude_expand_escapes(line); patternStr = QString::fromUtf8(line); patterns.append(patternStr); From 1a710eac1dfc83434fc3b1b83d21d33b2cb4da60 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Wed, 16 Jul 2025 18:44:29 +0200 Subject: [PATCH 3/3] fix: simplify code reverting to the original version Signed-off-by: Matthieu Gallien --- src/csync/csync_exclude.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index d8b8063e43..0855b028d6 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -301,8 +301,7 @@ void ExcludedFiles::loadExcludeFilePatterns(const QString &basePath, QFile &file continue; } csync_exclude_expand_escapes(line); - patternStr = QString::fromUtf8(line); - patterns.append(patternStr); + patterns.append(QString::fromUtf8(line)); } _allExcludes[basePath].append(patterns);