From 610e2b924020fe2d6a55e7ca6651f309b85c2d1d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 24 Sep 2020 21:55:04 -0700 Subject: blame: validate and peel the object names on the ignore list The command reads list of object names to place on the ignore list either from the command line or from a file, but they are not checked with their object type (those read from the file are not even checked for object existence). Extend the oidset_parse_file() API and allow it to take a callback that can be used to die (e.g. when an inappropriate input is read) or modify the object name read (e.g. when a tag pointing at a commit is read, and the caller wants a commit object name), and use it in the code that handles ignore list. Signed-off-by: Junio C Hamano --- oidset.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'oidset.h') diff --git a/oidset.h b/oidset.h index 209ae7a173..01f6560283 100644 --- a/oidset.h +++ b/oidset.h @@ -73,6 +73,15 @@ void oidset_clear(struct oidset *set); */ void oidset_parse_file(struct oidset *set, const char *path); +/* + * Similar to the above, but with a callback which can (1) return non-zero to + * signal displeasure with the object and (2) replace object ID with something + * else (meant to be used to "peel"). + */ +typedef int (*oidset_parse_tweak_fn)(struct object_id *, void *); +void oidset_parse_file_carefully(struct oidset *set, const char *path, + oidset_parse_tweak_fn fn, void *cbdata); + struct oidset_iter { kh_oid_set_t *set; khiter_t iter; -- cgit v1.3