Commit Diff


commit - 9af0bf574d6aae948563786ea51e407abdc82d1b
commit + 55856f575af1531296772ec6a544e38b06b006ad
blob - 5b85ac8573c3f6ead09a50e80a15af2e78d794dc
blob + c25715bba0e987026f6a367baab599c55273b1fa
--- lib/pack_create.c
+++ lib/pack_create.c
@@ -1091,23 +1091,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)