The commit-graph feature is not compatible with history-rewriting
features such as shallow clones. When running a 'git fetch' with
any of the shallow/unshallow options, destroy the commit-graph
file and override core.commitGraph to be false.

Signed-off-by: Derrick Stolee <dsto...@microsoft.com>
---
 builtin/fetch.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index af896e4b74..2001dca881 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1452,6 +1452,12 @@ int cmd_fetch(int argc, const char **argv, const char 
*prefix)
                }
        }
 
+       if (update_shallow || depth || deepen_since || deepen_not.nr ||
+           deepen_relative || unshallow || update_shallow || 
is_repository_shallow()) {
+               destroy_commit_graph(get_object_directory());
+               core_commit_graph = 0;
+       }
+
        if (remote) {
                if (filter_options.choice || repository_format_partial_clone)
                        fetch_one_setup_partial(remote);
-- 
2.16.2.338.gcfe06ae955

Reply via email to