diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-04-14 14:13:38 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2017-04-14 14:13:38 +0100 |
commit | abba036106882a8893ff0f313d51ef60eeba8810 (patch) | |
tree | 6df81b3385009ead824f2832c2d642fe6538a6b6 | |
parent | Simplify auto update task (diff) | |
download | gentoobrowse-api-abba036106882a8893ff0f313d51ef60eeba8810.tar.bz2 gentoobrowse-api-abba036106882a8893ff0f313d51ef60eeba8810.tar.xz gentoobrowse-api-abba036106882a8893ff0f313d51ef60eeba8810.zip |
Only revwalk to the required commit range
-rw-r--r-- | gentoobrowse-api/service/maintenanceGitOperations.cpp | 6 |
1 files 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)); |