commit - 781eeac34260f564a125604e8368f21b88f97bddd6a6a8f46c94af7db63f8fdc
commit + 2c99888b7cec0e63aafbf4f216c44ddbeb14798be8944058def910c098cfd136
blob - 4f267def2ff3f2b44bcf7881c8bbf58e5680ec24ec27becad84b26e9769145e5
blob + 3740f43d49205bcf0c498bff69c7f1d18a8ce28741eb44ea5c4a4b0a81c1f329
--- libexec/got-read-pack/got-read-pack.c
+++ libexec/got-read-pack/got-read-pack.c
return err;
while (commit) {
- struct got_object_qid *pid;
+ struct got_object_qid *pid, *qid, *tmp;
int idx;
parents = got_object_commit_get_parent_ids(commit);
commit = NULL;
pid = STAILQ_FIRST(&repaint);
- if (pid) {
- struct got_object_qid *qid, *tmp;
+ if (pid == NULL)
+ break;
- err = paint_commit(pid, color);
+ err = paint_commit(pid, color);
+ if (err)
+ break;
+
+ if (!got_object_idset_contains(set, &pid->id)) {
+ err = got_object_idset_add(set, &pid->id, NULL);
if (err)
break;
+ }
- if (!got_object_idset_contains(set, &pid->id)) {
- err = got_object_idset_add(set, &pid->id, NULL);
- if (err)
- break;
- }
+ STAILQ_REMOVE_HEAD(&repaint, entry);
- STAILQ_REMOVE_HEAD(&repaint, entry);
+ /* Insert or replace this commit on the painted list. */
+ STAILQ_FOREACH(qid, painted, entry) {
+ if (got_object_id_cmp(&qid->id, &pid->id) != 0)
+ continue;
+ err = paint_commit(qid, color);
+ if (err)
+ goto done;
+ got_object_qid_free(pid);
+ pid = qid;
+ break;
+ }
+ if (qid == NULL) {
+ STAILQ_INSERT_TAIL(painted, pid, entry);
+ (*npainted)++;
+ }
- /* Insert or replace this commit on the painted list. */
- STAILQ_FOREACH(qid, painted, entry) {
- if (got_object_id_cmp(&qid->id, &pid->id) != 0)
- continue;
- err = paint_commit(qid, color);
- if (err)
- goto done;
- got_object_qid_free(pid);
- pid = qid;
- break;
- }
- if (qid == NULL) {
- STAILQ_INSERT_TAIL(painted, pid, entry);
- (*npainted)++;
- }
+ /*
+ * In case this commit is on the caller's list of
+ * pending commits to traverse, repaint it there.
+ */
+ STAILQ_FOREACH_SAFE(qid, ids, entry, tmp) {
+ if (got_object_id_cmp(&qid->id, &pid->id) != 0)
+ continue;
+ err = paint_commit(qid, color);
+ if (err)
+ goto done;
+ break;
+ }
+ idx = got_packidx_get_object_idx(packidx, &pid->id);
+ if (idx == -1) {
/*
- * In case this commit is on the caller's list of
- * pending commits to traverse, repaint it there.
+ * Should not happen because we only queue
+ * parents which exist in our pack file.
*/
- STAILQ_FOREACH_SAFE(qid, ids, entry, tmp) {
- if (got_object_id_cmp(&qid->id, &pid->id) != 0)
- continue;
- err = paint_commit(qid, color);
- if (err)
- goto done;
- break;
- }
-
- idx = got_packidx_get_object_idx(packidx, &pid->id);
- if (idx == -1) {
- /*
- * Should not happen because we only queue
- * parents which exist in our pack file.
- */
- err = got_error(GOT_ERR_NO_OBJ);
- break;
- }
-
- err = open_commit(&commit, pack, packidx, idx,
- &pid->id, objcache);
- if (err)
- break;
+ err = got_error(GOT_ERR_NO_OBJ);
+ break;
}
+
+ err = open_commit(&commit, pack, packidx, idx, &pid->id,
+ objcache);
+ if (err)
+ break;
}
done:
if (commit)