Skip to content

Commit 0803f9c

Browse files
ldenningtongitster
authored andcommitted
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 <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e5b17bd commit 0803f9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

commit-graph.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,13 @@ static int prepare_commit_graph(struct repository *r)
632632
struct object_directory *odb;
633633

634634
/*
635+
* Early return if there is no git dir or if the commit graph is
636+
* disabled.
637+
*
635638
* This must come before the "already attempted?" check below, because
636639
* we want to disable even an already-loaded graph file.
637640
*/
638-
if (r->commit_graph_disabled)
641+
if (!r->gitdir || r->commit_graph_disabled)
639642
return 0;
640643

641644
if (r->objects->commit_graph_attempted)

0 commit comments

Comments
 (0)