1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-11 14:46:08 +02:00

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>
This commit is contained in:
Lessley Dennington 2021-12-06 15:55:56 +00:00 committed by Junio C Hamano
parent e5b17bda8b
commit 0803f9c7cd

View File

@ -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)