Commit Diff


commit - 36a191599253995f5b4889f87933a9db3626b54e6b2ef7b16f3ed21aaea7d67c
commit + eb01f20d389199f1eda0b341698024ab0cabb747a80a873043a0a9faec9260f0
blob - 69e72cf5957261d089e4c7aea5050ba44c68481c9ac32587f7279a9a3c353dba
blob + 4032a189387b392730c8edd814fa361053e8dc99903069f1765611fc49922076
--- lib/pack_create_privsep.c	
+++ lib/pack_create_privsep.c	
@@ -219,7 +219,7 @@ recv_painted_commit(void *arg, struct got_object_id *i
 {
 	const struct got_error *err = NULL;
 	struct recv_painted_commit_arg *a = arg;
-	struct got_object_qid *qid, *tmp;
+	struct got_object_qid *qid;
 
 	if (a->cancel_cb) {
 		err = a->cancel_cb(a->cancel_arg);
@@ -256,17 +256,18 @@ recv_painted_commit(void *arg, struct got_object_id *i
 		    "%s invalid commit color %"PRIdPTR, __func__, color);
 	}
 
-	STAILQ_FOREACH_SAFE(qid, a->ids, entry, tmp) {
+	STAILQ_FOREACH(qid, a->ids, entry) {
+		int ocolor;
 		if (got_object_id_cmp(&qid->id, id) != 0)
 			continue;
-		STAILQ_REMOVE(a->ids, qid, got_object_qid, entry);
-		color = (intptr_t)qid->data;
-		if (*(a->qid0) == qid)
-			*(a->qid0) = NULL;
-		got_object_qid_free(qid);
-		(*a->nqueued)--;
-		if (color == COLOR_SKIP)
-			(*a->nskip)--;
+		ocolor = (intptr_t)qid->data;
+		if (ocolor != color) {
+			got_pack_paint_commit(qid, color);
+			if (ocolor == COLOR_SKIP)
+				(*a->nskip)--;
+			else if (color == COLOR_SKIP)
+				(*a->nskip)++;
+		}
 		break;
 	}