aboutsummaryrefslogtreecommitdiffstats
path: root/commit-graph.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-12-21 15:03:17 -0800
committerJunio C Hamano <gitster@pobox.com>2021-12-21 15:03:17 -0800
commit8d2c37320bd01bbce4b88365c160bc4a542bee48 (patch)
treed805155422fb863b694eaaeb71967d9667f9e81d /commit-graph.c
parentMerge branch 'en/name-rev-shorter-output' (diff)
parentblame: enable and test the sparse index (diff)
downloadgit-8d2c37320bd01bbce4b88365c160bc4a542bee48.tar.gz
git-8d2c37320bd01bbce4b88365c160bc4a542bee48.zip
Merge branch 'ld/sparse-diff-blame'
Teach diff and blame to work well with sparse index. * ld/sparse-diff-blame: blame: enable and test the sparse index diff: enable and test the sparse index diff: replace --staged with --cached in t1092 tests repo-settings: prepare_repo_settings only in git repos test-read-cache: set up repo after git directory commit-graph: return if there is no git directory git: ensure correct git directory setup with -h
Diffstat (limited to 'commit-graph.c')
-rw-r--r--commit-graph.c5
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)