revert e7a5b9e9b763327a7e1ddd69f6bc533565d60794; it changed blame output
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/lib/commit_graph.c b/lib/commit_graph.c
index 51276fe..d2d7bd8 100644
--- a/lib/commit_graph.c
+++ b/lib/commit_graph.c
@@ -164,12 +164,27 @@ 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 ||
@@ -414,11 +429,6 @@ fetch_commits_from_open_branches(struct got_commit_graph *graph,
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) {
@@ -428,6 +438,9 @@ fetch_commits_from_open_branches(struct got_commit_graph *graph,
* 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)