aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2019-11-13 17:56:59 +0100
committerDaniel Borkmann <daniel@iogearbox.net>2019-11-13 17:57:16 +0100
commit45831af4fa6e1890f19d6e9e2f35ad4e36f35643 (patch)
tree16bd9cc5c737fa2aad387862e2c516f4a3780fd2
parentecdbb0c79d9274a04a1da9efd429c1c88fe9bd9a (diff)
downloadl2md-45831af4fa6e1890f19d6e9e2f35ad4e36f35643.tar.gz
l2md: warn when revwalk did not succeed in prep step
If we couldn't even start walking the repo, throw a warning to inform what went wrong. Now that we've bumped the open file limit this issue should be mitigated, but this indicates that potentially the repo needs a repack. Once libgit2 supports this, we can actually do it here instead. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--repo.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/repo.c b/repo.c
index c5ca8e8..35455f2 100644
--- a/repo.c
+++ b/repo.c
@@ -195,7 +195,7 @@ void repo_walk_files(struct config *cfg, struct config_repo *repo, uint32_t url,
git_commit *commit;
git_object *object;
uint32_t count = 0;
- int ret;
+ int ret, it;
ret = git_repository_open(&repo->git, path);
if (ret)
@@ -218,7 +218,7 @@ void repo_walk_files(struct config *cfg, struct config_repo *repo, uint32_t url,
gettimeofday(&start, NULL);
- while (!git_revwalk_next(&coid, walker)) {
+ while (!(it = git_revwalk_next(&coid, walker))) {
ret = git_commit_lookup(&commit, repo->git, &coid);
if (ret)
panic_git("Cannot look up commit");
@@ -258,6 +258,9 @@ void repo_walk_files(struct config *cfg, struct config_repo *repo, uint32_t url,
count++;
}
+ if (it && it != GIT_ITEROVER && !count)
+ warn_git("Performing revwalk did not succeed! Repo might need repack");
+
gettimeofday(&end, NULL);
timeval_sub(&res, &end, &start);