commit d60b4329437936f4c90fe1c112ef27be6b86ddf7
from: Stefan Sperling <stsp@stsp.name>
via: Thomas Adam <thomas@xteddy.org>
date: Wed Feb 05 12:44:19 2025 UTC

avoid a needless check for set membership in got_pack_repaint_parent_commits()

The list of ids traversed here won't contain IDs already present in the set.

commit - 3271b564404407796a381db56201ee59a950b6bc
commit + d60b4329437936f4c90fe1c112ef27be6b86ddf7
blob - 36d955d11f53a84ead968c6a743e7d1a4b7a5ab2
blob + 9344a08b911bee2ed4f078b667d76dcfedc24c16
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1092,11 +1092,9 @@ got_pack_repaint_parent_commits(struct got_object_id *
 			break;
 
 		STAILQ_REMOVE_HEAD(&ids, entry);
-		if (!got_object_idset_contains(set, &qid->id)) {
-			err = got_object_idset_add(set, &qid->id, NULL);
-			if (err)
-				break;
-		}
+		err = got_object_idset_add(set, &qid->id, NULL);
+		if (err)
+			break;
 
 		err = got_object_open_as_commit(&commit, repo, &qid->id);
 		if (err)