Commit Diff


commit - ad51b523dfdb978c985d19acf21b5508690ab601
commit + bd780c5b50ee006f9ae89910ed0db05d9574d197
blob - 2a41e8fd7c124e45e9207604dc32308d4979cd05
blob + 8f72aa6c4993b257f992a9300fa14467f7402aa6
--- lib/pack_create_privsep.c
+++ lib/pack_create_privsep.c
@@ -88,38 +88,6 @@ send_idset(struct imsgbuf *ibuf, struct got_object_ids
 
 	if (sia.nids > 0) {
 		err = got_privsep_send_object_idlist(ibuf, sia.ids, sia.nids);
-		if (err)
-			return err;
-	}
-
-	return got_privsep_send_object_idlist_done(ibuf);
-}
-
-static const struct got_error *
-send_filtered_id_queue(struct imsgbuf *ibuf, struct got_object_id_queue *ids,
-    uintptr_t color)
-{
-	const struct got_error *err = NULL;
-	struct got_object_qid *qid;
-	struct got_object_id *filtered_ids[GOT_IMSG_OBJ_ID_LIST_MAX_NIDS];
-	int nids = 0;
-
-	STAILQ_FOREACH(qid, ids, entry) {
-		if (color != (intptr_t)qid->data)
-			continue;
-
-		filtered_ids[nids++] = &qid->id;
-		if (nids >= GOT_IMSG_OBJ_ID_LIST_MAX_NIDS) {
-			err = got_privsep_send_object_idlist(ibuf,
-			    filtered_ids, nids);
-			if (err)
-				return err;
-			nids = 0;
-		}
-	}
-
-	if (nids > 0) {
-		err = got_privsep_send_object_idlist(ibuf, filtered_ids, nids);
 		if (err)
 			return err;
 	}
@@ -323,21 +291,11 @@ paint_packed_commits(struct got_object_qid **qid0,
 	STAILQ_INIT(&next_ids);
 
 	err = got_privsep_send_painting_request(pack->privsep_child->ibuf);
-	if (err)
-		return err;
-
-	err = send_filtered_id_queue(pack->privsep_child->ibuf, ids,
-	    COLOR_KEEP);
-	if (err)
-		return err;
-
-	err = send_filtered_id_queue(pack->privsep_child->ibuf, ids,
-	    COLOR_DROP);
 	if (err)
 		return err;
 
-	err = send_filtered_id_queue(pack->privsep_child->ibuf, ids,
-	    COLOR_SKIP);
+	err = got_privsep_send_object_id_queue(pack->privsep_child->ibuf,
+	    ids, *nqueued);
 	if (err)
 		return err;
 
blob - 3e11305bebb5cfea0725ac4325aca4c560b97c10
blob + 4e65a3f8939e6541fe568b471a16f36581536485
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -1901,9 +1901,8 @@ commit_painting_request(struct imsg *imsg, struct imsg
 	const struct got_error *err = NULL;
 	size_t datalen;
 	struct got_object_id_queue ids;
-	size_t nkeep = 0, ndrop = 0, nskip = 0;
-	int nids = 0;
-	uintptr_t color;
+	size_t nids;
+	int nqueued = 0, done = 0;
 
 	STAILQ_INIT(&ids);
 
@@ -1911,42 +1910,23 @@ commit_painting_request(struct imsg *imsg, struct imsg
 	if (datalen != 0)
 		return got_error(GOT_ERR_PRIVSEP_LEN);
 
-	color = COLOR_KEEP;
-	err = recv_object_id_queue(&nkeep, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + nkeep > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
+	while (!done) {
+		err = got_privsep_recv_object_id_queue(&done, &ids, &nids, ibuf);
+		if (err)
+			goto done;
+		if (nqueued + nids > INT_MAX) {
+			err = got_error(GOT_ERR_PRIVSEP_LEN);
+			goto done;
+		}
+		nqueued += nids;
 	}
-	nids += nkeep;
 
-	color = COLOR_DROP;
-	err = recv_object_id_queue(&ndrop, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + ndrop > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
-	}
-	nids += ndrop;
-
-	color = COLOR_SKIP;
-	err = recv_object_id_queue(&nskip, &ids, (void *)color, NULL, ibuf);
-	if (err)
-		goto done;
-	if (nids + nskip > INT_MAX) {
-		err = got_error(GOT_ERR_PRIVSEP_LEN);
-		goto done;
-	}
-	nids += nskip;
-
-	err = paint_commits(&ids, &nids, keep, drop, skip,
+	err = paint_commits(&ids, &nqueued, keep, drop, skip,
 	    pack, packidx, ibuf, objcache);
 	if (err)
 		goto done;
 
-	err = got_privsep_send_painted_commits(ibuf, &ids, &nids, 0, 1);
+	err = got_privsep_send_painted_commits(ibuf, &ids, &nqueued, 0, 1);
 	if (err)
 		goto done;