no need to open a commit in got_commit_graph_iter_start()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index d255fe9..ce6e873 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -480,18 +480,13 @@ got_commit_graph_iter_start(struct got_commit_graph *graph,
got_cancel_cb cancel_cb, void *cancel_arg)
{
const struct got_error *err = NULL;
- struct got_commit_object *commit;
if (!TAILQ_EMPTY(&graph->iter_list))
return got_error(GOT_ERR_ITER_BUSY);
- err = got_object_open_as_commit(&commit, repo, id);
- if (err)
- return err;
-
err = got_object_idset_add(graph->open_branches, id, NULL);
if (err)
- goto done;
+ return err;
/* Locate first commit which changed graph->path. */
while (graph->iter_node == NULL &&
@@ -499,11 +494,10 @@ got_commit_graph_iter_start(struct got_commit_graph *graph,
err = fetch_commits_from_open_branches(graph, repo,
cancel_cb, cancel_arg);
if (err)
- break;
+ return err;
}
-done:
- got_object_commit_close(commit);
- return err;
+
+ return NULL;
}
const struct got_error *