diff options
Diffstat (limited to 'third_party/git/oidset.h')
-rw-r--r-- | third_party/git/oidset.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/third_party/git/oidset.h b/third_party/git/oidset.h index 5346563b0bcc..01f6560283c3 100644 --- a/third_party/git/oidset.h +++ b/third_party/git/oidset.h @@ -1,11 +1,10 @@ #ifndef OIDSET_H #define OIDSET_H -#include "hashmap.h" #include "khash.h" /** - * This API is similar to sha1-array, in that it maintains a set of object ids + * This API is similar to oid-array, in that it maintains a set of object ids * in a memory-efficient way. The major differences are: * * 1. It uses a hash, so we can do online duplicate removal, rather than @@ -56,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. */ @@ -69,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; |