summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenanceChangeLogs.cpp3
-rw-r--r--gentoobrowse-api/unittests/testChangeLog.cpp2
2 files changed, 5 insertions, 0 deletions
diff --git a/gentoobrowse-api/service/maintenanceChangeLogs.cpp b/gentoobrowse-api/service/maintenanceChangeLogs.cpp
index 46ef3e2..027429e 100644
--- a/gentoobrowse-api/service/maintenanceChangeLogs.cpp
+++ b/gentoobrowse-api/service/maintenanceChangeLogs.cpp
@@ -104,6 +104,9 @@ namespace Gentoo {
// Compare trees
StringList fs;
git_diff_foreach(diff.get(), onFile, onBinaryFile, nullptr, nullptr, &fs);
+ // Remove duplicate mentions of files
+ std::sort(fs.begin(), fs.end());
+ fs.erase(std::unique(fs.begin(), fs.end()), fs.end());
// Insert commit into DB
cli->bindParamS(1, str);
diff --git a/gentoobrowse-api/unittests/testChangeLog.cpp b/gentoobrowse-api/unittests/testChangeLog.cpp
index 412b328..df01a7b 100644
--- a/gentoobrowse-api/unittests/testChangeLog.cpp
+++ b/gentoobrowse-api/unittests/testChangeLog.cpp
@@ -22,9 +22,11 @@ BOOST_AUTO_TEST_CASE( importChangeLogs )
insRepo->execute();
const int64_t expectedLogCount = 125;
+ const int64_t expectedFilesCount = 9;
m->refreshChangeLogs();
SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.changelog", int64_t, expectedLogCount);
+ SQL_REQUIRE_EQUAL("SELECT ARRAY_LENGTH(files, 1) FROM gentoobrowse.changelog WHERE commitid = 'f8e9b2f0044232213a6e0299a3f31752e8dd9d24'", int64_t, expectedFilesCount);
db->execute("COPY gentoobrowse.changelog TO '/tmp/changelog.tsv'");
}