diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2019-11-13 17:56:59 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-11-13 17:57:16 +0100 |
commit | 45831af4fa6e1890f19d6e9e2f35ad4e36f35643 (patch) | |
tree | 16bd9cc5c737fa2aad387862e2c516f4a3780fd2 | |
parent | ecdbb0c79d9274a04a1da9efd429c1c88fe9bd9a (diff) | |
download | l2md-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.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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); |