diff options
author | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·20+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·45+0100 |
commit | f4609b896fac842433bd495c166d5987852a6a73 (patch) | |
tree | 95511c465c54c4f5d27e5d39ce187e2a1dd82bd3 /third_party/git/oidset.h | |
parent | 082c006c04343a78d87b6c6ab3608c25d6213c3f (diff) |
merge(3p/git): Merge git subtree at v2.29.2 r/1890
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
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; |