commit e7a5b9e9b763327a7e1ddd69f6bc533565d60794 from: Stefan Sperling date: Sun Jan 05 00:23:54 2020 UTC commit graph's close_branch() can be inlined in one place commit - df8cd9c6cd301882ae057c712e2aee94a4b0b195 commit + e7a5b9e9b763327a7e1ddd69f6bc533565d60794 blob - d2d7bd81d20a0bc7fb36411f186d28e28e4ce1e5 blob + 51276fea65a8e55f42f4dfaa63fe70f9ddabf7d4 --- lib/commit_graph.c +++ lib/commit_graph.c @@ -164,27 +164,12 @@ add_node_to_iter_list(struct got_commit_graph *graph, } static const struct got_error * -close_branch(struct got_commit_graph *graph, struct got_object_id *commit_id) -{ - const struct got_error *err; - - err = got_object_idset_remove(NULL, graph->open_branches, commit_id); - if (err && err->code != GOT_ERR_NO_OBJ) - return err; - return NULL; -} - -static const struct got_error * advance_branch(struct got_commit_graph *graph, struct got_object_id *commit_id, struct got_commit_object *commit, struct got_repository *repo) { const struct got_error *err; struct got_object_qid *qid; - err = close_branch(graph, commit_id); - if (err) - return err; - if (graph->flags & GOT_COMMIT_GRAPH_FIRST_PARENT_TRAVERSAL) { qid = SIMPLEQ_FIRST(&commit->parent_ids); if (qid == NULL || @@ -429,6 +414,11 @@ fetch_commits_from_open_branches(struct got_commit_gra commit = arg.tips[i].commit; new_node = arg.tips[i].new_node; + err = got_object_idset_remove(NULL, graph->open_branches, + commit_id); + if (err && err->code != GOT_ERR_NO_OBJ) + break; + err = detect_changed_path(&changed, commit, commit_id, graph->path, repo); if (err) { @@ -438,9 +428,6 @@ fetch_commits_from_open_branches(struct got_commit_gra * History of the path stops here on the current * branch. Keep going on other branches. */ - err = close_branch(graph, commit_id); - if (err) - break; continue; } if (changed)