Commit Diff


commit - eed86c18e9c3083942c1f28f02fd2ee3b1b0b6f08d28fb21ad6137e5ebaf5ff9
commit + 9f39b41c67c33d8797617c5f3176f6ca0194d1e8de389cd24ea97328a809fc50
blob - c41fed1755630293011b8cc1366dcd683123efc3b4e5a12515923170217bf502
blob + 4131582a4a1521051e8a847bac311d68ac9aaace975b6fcba2a2e7ffef0ffab3
--- 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,16 +1214,6 @@ findtwixt(struct got_object_id ***res, int *nres, int 
 		goto done;
 	}
 
-	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_KEEP, &ids, repo);
-		if (err)
-			goto done;
-		nqueued++;
-	}
-
 	for (i = 0; i < ntail; i++) {
 		struct got_object_id *id = tail[i];
 		if (id == NULL)
@@ -1231,6 +1224,16 @@ findtwixt(struct got_object_id ***res, int *nres, int 
 		nqueued++;
 	}
 
+	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_KEEP, &ids, repo);
+		if (err)
+			goto done;
+		nqueued++;
+	}
+
 	err = got_pack_paint_commits(ncolored, &ids, nqueued,
 	    keep, drop, skip, repo, progress_cb, progress_arg, rl,
 	    cancel_cb, cancel_arg);
blob - d8ee76157b52499f8695da19ccab1988d8aea57619ee814e202c311e8b4e55b7
blob + 7ab806f98fe23369d8dad8ed99cb39e76c660c57c6a8a883b88acf16a0887051
--- 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);
 }