commit - bfd1f6daa47c07c6796399a53b51437436cc81b5
commit + 649fc316f20c14aa1b38eeb77feacc90ab02eaa9
blob - a6746588f304995cc44413ec00180316f86576d3
blob + bd8091df251a7ee59403fe2a6d5ae2b91e4de099
--- lib/commit_graph.c
+++ lib/commit_graph.c
}
static const struct got_error *
-add_node(struct got_commit_graph_node **new_node,
+add_node(struct got_commit_graph_node **new_node, int *changed,
struct got_commit_graph *graph, struct got_object_id *commit_id,
struct got_commit_object *commit, struct got_commit_graph_node *child_node,
struct got_repository *repo)
const struct got_error *err = NULL;
struct got_commit_graph_node *node;
struct got_object_qid *pid;
- int changed = 0, branch_done = 0;
+ int branch_done = 0;
*new_node = NULL;
+ *changed = 0;
node = calloc(1, sizeof(*node));
if (node == NULL)
return err;
}
- err = detect_changed_path(&changed, commit, commit_id, graph->path,
+ err = detect_changed_path(changed, commit, commit_id, graph->path,
repo);
if (err) {
if (err->code == GOT_ERR_NO_OBJ) {
}
}
- if (changed)
+ if (*changed)
add_node_to_iter_list(graph, node, child_node);
if (branch_done)
{
const struct got_error *err = NULL;
struct got_commit_object *commit;
+ int changed;
*graph = NULL;
if (first_parent_traversal)
(*graph)->flags |= GOT_COMMIT_GRAPH_FIRST_PARENT_TRAVERSAL;
- err = add_node(&(*graph)->head_node, *graph, commit_id, commit, NULL,
- repo);
+ err = add_node(&(*graph)->head_node, &changed, *graph, commit_id,
+ commit, NULL, repo);
got_object_commit_close(commit);
if (err) {
got_commit_graph_close(*graph);
int i;
*ncommits = 0;
- if (changed_id)
- *changed_id = NULL;
+ *changed_id = NULL;
arg.ntips = got_object_idset_num_elements(graph->open_branches);
if (arg.ntips == 0)
if (err)
break;
- err = detect_changed_path(&changed, commit, commit_id,
- graph->path, repo);
- if (err) {
- got_object_commit_close(commit);
- if (err->code != GOT_ERR_NO_OBJ)
- break;
- err = close_branch(graph, commit_id);
- if (err)
- break;
- continue;
- }
- if (changed && changed_id && *changed_id == NULL)
+ err = add_node(&new_node, &changed, graph, commit_id, commit,
+ child_node, repo);
+ if (changed && *changed_id == NULL)
*changed_id = commit_id;
- err = add_node(&new_node, graph, commit_id, commit, child_node,
- repo);
got_object_commit_close(commit);
if (err)
break;