diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2021-02-11 15:39:13 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-11 09:33:01 -0800 |
commit | c85eec7fc37e1ca79072f263ae6ea1ee305ba38c (patch) | |
tree | 6f131ee943998815cad7959a976be55d9a0ad798 /commit-graph.c | |
parent | 773e25afc41b1b6533fa9ae2cd825d0b4a697fad (diff) | |
download | git-c85eec7fc37e1ca79072f263ae6ea1ee305ba38c.tar.gz |
commit-graph: when incompatible with graphs, indicate why
When `gc.writeCommitGraph = true`, it is possible that the commit-graph
is _still_ not written: replace objects, grafts and shallow repositories
are incompatible with the commit-graph feature.
Under such circumstances, we need to indicate to the user why the
commit-graph was not written instead of staying silent about it.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit-graph.c')
-rw-r--r-- | commit-graph.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/commit-graph.c b/commit-graph.c index 031641014f..8fd4804343 100644 --- a/commit-graph.c +++ b/commit-graph.c @@ -205,16 +205,24 @@ static int commit_graph_compatible(struct repository *r) if (read_replace_refs) { prepare_replace_object(r); - if (hashmap_get_size(&r->objects->replace_map->map)) + if (hashmap_get_size(&r->objects->replace_map->map)) { + warning(_("repository contains replace objects; " + "skipping commit-graph")); return 0; + } } prepare_commit_graft(r); if (r->parsed_objects && - (r->parsed_objects->grafts_nr || r->parsed_objects->substituted_parent)) + (r->parsed_objects->grafts_nr || r->parsed_objects->substituted_parent)) { + warning(_("repository contains (deprecated) grafts; " + "skipping commit-graph")); return 0; - if (is_repository_shallow(r)) + } + if (is_repository_shallow(r)) { + warning(_("repository is shallow; skipping commit-graph")); return 0; + } return 1; } |