commit-graph: not compatible with uninitialized repo
[gitweb.git] / commit-graph.c
index 2c01fa433f3d32c653b9c06f248fac58fece5262..cee2caab5c60de5dc778840d931ae6eda8782fcc 100644 (file)
@@ -62,12 +62,21 @@ extern int read_replace_refs;
 
 static int commit_graph_compatible(struct repository *r)
 {
+       if (!r->gitdir)
+               return 0;
+
        if (read_replace_refs) {
                prepare_replace_object(r);
                if (hashmap_get_size(&r->objects->replace_map->map))
                        return 0;
        }
 
+       prepare_commit_graft(r);
+       if (r->parsed_objects && r->parsed_objects->grafts_nr)
+               return 0;
+       if (is_repository_shallow(r))
+               return 0;
+
        return 1;
 }