commit - 4088ab23bf2d330dc66483a747e0efb6c185eed8
commit + 47f028303ca0cb504743f84d2658e815f23ae53b
blob - d9a0d79f6f8a04fd392ed4bdd60090f2d26c73ab
blob + 2d8a494fd6985be88a80609324aa75abab76b77d
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
}
static const struct got_error *
-recv_object_id_queue(struct got_object_id_queue *queue, struct imsgbuf *ibuf)
+recv_object_id_queue(struct got_object_id_queue *queue,
+ struct got_object_idset *queued_ids, struct imsgbuf *ibuf)
{
const struct got_error *err = NULL;
int done = 0;
return err;
memcpy(&qid->id, &ids[i], sizeof(qid->id));
STAILQ_INSERT_TAIL(queue, qid, entry);
+ err = got_object_idset_add(queued_ids, &qid->id, NULL);
+ if (err)
+ return err;
}
}
struct got_commit_object *commit = NULL;
struct got_object_id *tree_id = NULL;
size_t totlen = 0;
- struct got_object_idset *idset;
+ struct got_object_idset *idset, *queued_ids = NULL;
int i, idx, have_all_entries = 1;
struct enumerated_tree *trees = NULL;
size_t ntrees = 0, nalloc = 16;
goto done;
}
- err = recv_object_id_queue(&commit_ids, ibuf);
+ queued_ids = got_object_idset_alloc();
+ if (queued_ids == NULL) {
+ err = got_error_from_errno("got_object_idset_alloc");
+ goto done;
+ }
+
+ err = recv_object_id_queue(&commit_ids, queued_ids, ibuf);
if (err)
goto done;
STAILQ_FOREACH(pid, parents, entry) {
if (got_object_idset_contains(idset, &pid->id))
continue;
+ if (got_object_idset_contains(queued_ids, &pid->id))
+ continue;
err = got_object_qid_alloc_partial(&qid);
if (err)
goto done;
got_object_id_queue_free(&commit_ids);
if (idset)
got_object_idset_free(idset);
+ if (queued_ids)
+ got_object_idset_free(queued_ids);
for (i = 0; i < ntrees; i++) {
struct enumerated_tree *tree = &trees[i];
free(tree->buf);