summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/maintenanceGitOperations.cpp6
-rw-r--r--gentoobrowse-api/unittests/testMaintenance.cpp1
2 files changed, 7 insertions, 0 deletions
diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp
index c867c50..583968c 100644
--- a/gentoobrowse-api/service/maintenanceGitOperations.cpp
+++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp
@@ -167,6 +167,12 @@ namespace Gentoo {
gitSafeGet(git_reference_name_to_id, repo.get(), "HEAD") :
gitSafeGet(git_oid_fromstr, targetRef.c_str());
auto headCommit = gitSafeGet(git_commit_lookup, git_commit_free, repo.get(), &headCommitOid);
+ auto updateLastCommit = db->modify("UPDATE gentoobrowse.repos SET lastCommit = ? WHERE repoId = ?");
+ char buf[41];
+ git_oid_tostr(buf, sizeof(buf), &headCommitOid);
+ updateLastCommit->bindParamS(0, buf);
+ updateLastCommit->bindParamI(1, repoId);
+ updateLastCommit->execute();
auto lastTree = gitSafeGet(git_commit_tree, git_tree_free, lastCommit.get());
auto headTree = gitSafeGet(git_commit_tree, git_tree_free, headCommit.get());
diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp
index dd5d5ad..26272d1 100644
--- a/gentoobrowse-api/unittests/testMaintenance.cpp
+++ b/gentoobrowse-api/unittests/testMaintenance.cpp
@@ -195,6 +195,7 @@ BOOST_AUTO_TEST_CASE( testRefreshGitRepository )
// Import it
m->refreshPackageTreeGit();
+ SQL_REQUIRE_EQUAL(R"SQL(SELECT lastCommit FROM gentoobrowse.repos)SQL", std::string, "40539afe6705aee26a55bb861f5e892ae7240057");
BOOST_TEST_CONTEXT("libkgapi was moved correctly") {
BOOST_TEST_CONTEXT("from net-libs to kde-apps") {
SQL_REQUIRE_EQUAL(R"SQL(SELECT COUNT(*) FROM gentoobrowse.categories c, gentoobrowse.packages p