]> git.ipfire.org Git - thirdparty/git.git/commitdiff
commit-graph: return if there is no git directory
authorLessley Dennington <lessleydennington@gmail.com>
Mon, 6 Dec 2021 15:55:56 +0000 (15:55 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Dec 2021 17:55:05 +0000 (09:55 -0800)
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>
commit-graph.c

index 2706683acfe1c1fc982b1c3119b3e895cac57006..265c010122e8edefc141f1dec8f506078bbbee19 100644 (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)