From abba036106882a8893ff0f313d51ef60eeba8810 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Apr 2017 14:13:38 +0100 Subject: Only revwalk to the required commit range --- gentoobrowse-api/service/maintenanceGitOperations.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index 0b909b9..feba275 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -48,15 +48,12 @@ namespace Gentoo { // Set up walker auto walker = gitSafeGet(git_revwalk_new, git_revwalk_free, repo); gitSafe(git_revwalk_push, walker.get(), &headCommitOid); + gitSafe(git_revwalk_hide, walker.get(), &lastCommitOid); git_oid oid; char str[GIT_OID_HEXSZ + 1]; // Walk through revisions while (!git_revwalk_next(&oid, walker.get())) { - git_oid_tostr(str, sizeof(str), &oid); - if (git_oid_equal(&oid, &lastCommitOid)) { - break; - } // Get commit auto commit = gitSafeGet(git_commit_lookup, git_commit_free, repo, &oid); @@ -80,6 +77,7 @@ namespace Gentoo { fs.erase(std::unique(fs.begin(), fs.end()), fs.end()); // Insert commit into DB + git_oid_tostr(str, sizeof(str), &oid); cli->bindParamS(1, str); auto sig = git_commit_author(commit.get()); cli->bindParamT(2, boost::posix_time::from_time_t(sig->when.time)); -- cgit v1.2.3