diff options
author | Anthony Iliopoulos <ailiopoulos@suse.com> | 2020-01-16 02:15:50 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-01-16 12:24:06 +0100 |
commit | 29a394f40fd9caa6bc5bbcee05310b906351b24a (patch) | |
tree | 26b9fff029ce178dbf9a5039241e7c5786d15e8e | |
parent | 41619edb0509565e5d35192aecb0cfb2249277a5 (diff) | |
download | l2md-29a394f40fd9caa6bc5bbcee05310b906351b24a.tar.gz |
l2md: don't panic on umatched git objects during repo walk
During repo walking, revparse expects to find objects based on the
oid:"m" specification, but public-inbox encodes some specific objects
(e.g. spam) differently, and that causes the walk to bail out. Fix by
skipping all objects that don't match the default mail specification.
Signed-off-by: Anthony Iliopoulos <ailiopoulos@suse.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | repo.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -245,6 +245,9 @@ void repo_walk_files(struct config *cfg, struct config_repo *repo, uint32_t url, slprintf(spec, sizeof(spec), "%s:%s", oid_curr, MAIL); ret = git_revparse_single(&object, repo->git, spec); + if (ret == GIT_ENOTFOUND) + goto skip; + if (ret || git_object_type(object) != GIT_OBJECT_BLOB) panic_git("Cannot revparse object"); @@ -253,9 +256,9 @@ void repo_walk_files(struct config *cfg, struct config_repo *repo, uint32_t url, (size_t)git_blob_rawsize(blob)); git_object_free(object); - git_commit_free(commit); - count++; +skip: + git_commit_free(commit); } if (it && it != GIT_ITEROVER && !count) |