diff --git a/oidset.c b/oidset.c index f63ce818f6..15d4e18c37 100644 --- a/oidset.c +++ b/oidset.c @@ -36,6 +36,11 @@ void oidset_clear(struct oidset *set) oidset_init(set, 0); } +int oidset_size(struct oidset *set) +{ + return kh_size(&set->set); +} + void oidset_parse_file(struct oidset *set, const char *path) { FILE *fp; diff --git a/oidset.h b/oidset.h index 5346563b0b..80c3a347f9 100644 --- a/oidset.h +++ b/oidset.h @@ -55,6 +55,11 @@ int oidset_insert(struct oidset *set, const struct object_id *oid); */ int oidset_remove(struct oidset *set, const struct object_id *oid); +/** + * Returns the number of oids in the set. + */ +int oidset_size(struct oidset *set); + /** * Remove all entries from the oidset, freeing any resources associated with * it.