Skip to content

Commit 9c3ee27

Browse files
committed
in_merge_bases_many() seems to misbehave when used with commit-graph?
Let's not hide the breakage under the rug. On the other hand, we _might_ want to do this "disable it" inside the in_merge_bases_many() code, so that "git merge-base" and friends won't be affected by the suspected breakage of commit-graph.
1 parent 18e23f6 commit 9c3ee27

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

remote.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,20 @@ static int is_reachable_in_reflog(const char *local, const struct ref *remote)
24082408
/* Toggle the "commit-graph" feature; return the previously set state. */
24092409
static int toggle_commit_graph(struct repository *repo, int disable) {
24102410
int prev = repo->commit_graph_disabled;
2411-
repo->commit_graph_disabled = disable;
2411+
static int should_toggle = -1;
2412+
2413+
if (should_toggle < 0) {
2414+
/*
2415+
* The in_merge_bases_many() seems to misbehave when
2416+
* the commit-graph feature is in use. Disable it for
2417+
* normal users, but keep it enabled when specifically
2418+
* testing the feature.
2419+
*/
2420+
should_toggle = !git_env_bool("GIT_TEST_COMMIT_GRAPH", 0);
2421+
}
2422+
2423+
if (should_toggle)
2424+
repo->commit_graph_disabled = disable;
24122425
return prev;
24132426
}
24142427

0 commit comments

Comments
 (0)