Commit Diff


commit - 67ffbc7745017d516ae151546e3add5c8691b48b
commit + 3271b564404407796a381db56201ee59a950b6bc
blob - 4ca6a1a924019209665082893c59d1f08111ce03
blob + 36d955d11f53a84ead968c6a743e7d1a4b7a5ab2
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1088,23 +1088,22 @@ got_pack_repaint_parent_commits(struct got_object_id *
 		commit = NULL;
 
 		qid = STAILQ_FIRST(&ids);
-		if (qid) {
-			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;
-			}
+		if (qid == NULL)
+			break;
 
-			err = got_object_open_as_commit(&commit, repo,
-			    &qid->id);
+		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;
-
-			got_object_qid_free(qid);
-			qid = NULL;
 		}
+
+		err = got_object_open_as_commit(&commit, repo, &qid->id);
+		if (err)
+			break;
+
+		got_object_qid_free(qid);
+		qid = NULL;
 	}
 
 	if (commit)