diff options
author | Lessley Dennington <lessleydennington@gmail.com> | 2021-12-06 18:55:56 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-12-06 20:55:05 +0300 |
commit | 0803f9c7cdff63d0c6cb992ba90f53fdcae50869 (patch) | |
tree | d35b40885086996a097775ad2f98b35cd3f563b1 /commit-graph.c | |
parent | e5b17bda8b6c830aa65f8c52e08755cae5b815a1 (diff) |
commit-graph: return if there is no git directory
Return early if git directory does not exist. This will protect against
test failures in the upcoming change to BUG in prepare_repo_settings if no
git directory exists.
Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/commit-graph.c b/commit-graph.c index 2706683acf..265c010122 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -632,10 +632,13 @@ static int prepare_commit_graph(struct repository *r) struct object_directory *odb; /* + * Early return if there is no git dir or if the commit graph is + * disabled. + * * 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) + if (!r->gitdir || r->commit_graph_disabled) return 0; if (r->objects->commit_graph_attempted) |