commit-graph: not compatible with grafts

Augment commit_graph_compatible(r) to return false when the given
repository r has commit grafts or is a shallow clone. Test that in these
situations we ignore existing commit-graph files and we do not write new
commit-graph files.

Helped-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Derrick Stolee
2018-08-20 18:24:30 +00:00
committed by Junio C Hamano
parent d6538246d3
commit 20fd6d5799
4 changed files with 46 additions and 1 deletions

View File

@ -68,6 +68,12 @@ static int commit_graph_compatible(struct repository *r)
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;
}