Merge branch 'ds/commit-graph-on-fetch'
authorJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:32 +0000 (13:19 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Sep 2019 04:19:32 +0000 (13:19 +0900)
A configuration variable tells "git fetch" to write the commit
graph after finishing.

* ds/commit-graph-on-fetch:
fetch: add fetch.writeCommitGraph config setting

1  2 
builtin/fetch.c
t/t5510-fetch.sh
diff --cc builtin/fetch.c
index 9b27ae968199a75e62a617b649b56788e501e076,d36a40385959a16eda95638a5a95355673d3cb9d..67c0eb88c655ab949845b626367b3f2192e9ccb6
@@@ -23,8 -23,7 +23,9 @@@
  #include "packfile.h"
  #include "list-objects-filter-options.h"
  #include "commit-reach.h"
 +#include "branch.h"
 +#include "promisor-remote.h"
+ #include "commit-graph.h"
  
  #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
  
@@@ -1759,6 -1716,20 +1760,20 @@@ int cmd_fetch(int argc, const char **ar
  
        string_list_clear(&list, 0);
  
 -              int commit_graph_flags = COMMIT_GRAPH_SPLIT;
+       prepare_repo_settings(the_repository);
+       if (the_repository->settings.fetch_write_commit_graph) {
 -                      commit_graph_flags |= COMMIT_GRAPH_PROGRESS;
++              int commit_graph_flags = COMMIT_GRAPH_WRITE_SPLIT;
+               struct split_commit_graph_opts split_opts;
+               memset(&split_opts, 0, sizeof(struct split_commit_graph_opts));
+               if (progress)
++                      commit_graph_flags |= COMMIT_GRAPH_WRITE_PROGRESS;
+               write_commit_graph_reachable(get_object_directory(),
+                                            commit_graph_flags,
+                                            &split_opts);
+       }
        close_object_store(the_repository->objects);
  
        if (enable_auto_gc) {
Simple merge