diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-10-07 11:32:55 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-10-07 11:32:55 +0900 |
commit | 098e8c6716b8c6abc29b6788acdb3ac8725f835d (patch) | |
tree | 1380bdbd3b2c5623c20fb2c5a8064bbeeb0fe7be /commit-graph.c | |
parent | 37ab7cb0a8e12d7f6e8e994cab48bc2383e03105 (diff) | |
parent | 6abada1880156df9c6a0de91fb23716e378e13d7 (diff) | |
download | git-098e8c6716b8c6abc29b6788acdb3ac8725f835d.tar.gz |
Merge branch 'jk/disable-commit-graph-during-upload-pack'
The "upload-pack" (the counterpart of "git fetch") needs to disable
commit-graph when responding to a shallow clone/fetch request, but
the way this was done made Git panic, which has been corrected.
* jk/disable-commit-graph-during-upload-pack:
upload-pack: disable commit graph more gently for shallow traversal
commit-graph: bump DIE_ON_LOAD check to actual load-time
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/commit-graph.c b/commit-graph.c index 5da0e16d12..394908ba9b 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -468,14 +468,21 @@ static int prepare_commit_graph(struct repository *r) { struct object_directory *odb; - if (git_env_bool(GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD, 0)) - die("dying as requested by the '%s' variable on commit-graph load!", - GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD); + /* + * This must come before the "already attempted?" check below, because + * we want to disable even an already-loaded graph file. + */ + if (r->commit_graph_disabled) + return 0; if (r->objects->commit_graph_attempted) return !!r->objects->commit_graph; r->objects->commit_graph_attempted = 1; + if (git_env_bool(GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD, 0)) + die("dying as requested by the '%s' variable on commit-graph load!", + GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD); + prepare_repo_settings(r); if (!git_env_bool(GIT_TEST_COMMIT_GRAPH, 0) && @@ -2101,3 +2108,8 @@ void free_commit_graph(struct commit_graph *g) free(g->filename); free(g); } + +void disable_commit_graph(struct repository *r) +{ + r->commit_graph_disabled = 1; +} |