diff options
Diffstat (limited to 'oidset.c')
-rw-r--r-- | oidset.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -36,8 +36,19 @@ 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) { + oidset_parse_file_carefully(set, path, NULL, NULL); +} + +void oidset_parse_file_carefully(struct oidset *set, const char *path, + oidset_parse_tweak_fn fn, void *cbdata) +{ FILE *fp; struct strbuf sb = STRBUF_INIT; struct object_id oid; @@ -63,6 +74,8 @@ void oidset_parse_file(struct oidset *set, const char *path) if (parse_oid_hex(sb.buf, &oid, &p) || *p != '\0') die("invalid object name: %s", sb.buf); + if (fn && fn(&oid, cbdata)) + continue; oidset_insert(set, &oid); } if (ferror(fp)) |