Commit Diff


commit - 26261316a5436dcd3fedb53080ff16d7024e9fa8
commit + ce6204164ae9cc9e4be847122484967b4c3c33c1
blob - 5c18c0d0c0aa48b9b7041d968cfff5cd850c0232
blob + 4b84755e2c4557df4a09e1117470fc18cf23bcd9
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1059,7 +1059,10 @@ got_pack_queue_commit_id(struct got_object_id_queue *i
 	if (err)
 		return err;
 
-	STAILQ_INSERT_TAIL(ids, qid, entry);
+	if (color == COLOR_KEEP)
+		STAILQ_INSERT_TAIL(ids, qid, entry);
+	else	
+		STAILQ_INSERT_HEAD(ids, qid, entry);
 	return got_pack_paint_commit(qid, color);
 }
 
@@ -1211,21 +1214,21 @@ findtwixt(struct got_object_id ***res, int *nres, int 
 		goto done;
 	}
 
-	for (i = 0; i < nhead; i++) {
-		struct got_object_id *id = head[i];
+	for (i = 0; i < ntail; i++) {
+		struct got_object_id *id = tail[i];
 		if (id == NULL)
 			continue;
-		err = queue_commit_or_tag_id(id, COLOR_KEEP, &ids, repo);
+		err = queue_commit_or_tag_id(id, COLOR_DROP, &ids, repo);
 		if (err)
 			goto done;
 		nqueued++;
 	}
 
-	for (i = 0; i < ntail; i++) {
-		struct got_object_id *id = tail[i];
+	for (i = 0; i < nhead; i++) {
+		struct got_object_id *id = head[i];
 		if (id == NULL)
 			continue;
-		err = queue_commit_or_tag_id(id, COLOR_DROP, &ids, repo);
+		err = queue_commit_or_tag_id(id, COLOR_KEEP, &ids, repo);
 		if (err)
 			goto done;
 		nqueued++;
blob - 7a56d2de17d20fb18c19bcd21fa33f9be540697c
blob + 3e11305bebb5cfea0725ac4325aca4c560b97c10
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
@@ -1676,7 +1676,10 @@ queue_commit_id(struct got_object_id_queue *ids, struc
 		return err;
 
 	memcpy(&qid->id, id, sizeof(qid->id));
-	STAILQ_INSERT_TAIL(ids, qid, entry);
+	if (color == COLOR_KEEP)
+		STAILQ_INSERT_TAIL(ids, qid, entry);
+	else
+		STAILQ_INSERT_HEAD(ids, qid, entry);
 	return paint_commit(qid, color);
 }