diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 5ad4f10004679f..8483f28c1151ab 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -670,6 +670,10 @@ core.gvfs:: is first accessed and brought down to the client. Git.exe can't currently tell the first access vs subsequent accesses so this flag just blocks them from occurring at all. + GVFS_PREFETCH_DURING_FETCH:: + Bit value 128 + While performing a `git fetch` command, use the gvfs-helper to + perform a "prefetch" of commits and trees. -- core.useGvfsHelper:: diff --git a/builtin/fetch.c b/builtin/fetch.c index bf6bab80fab915..1ca181e9835fcf 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -27,6 +27,8 @@ #include "branch.h" #include "promisor-remote.h" #include "commit-graph.h" +#include "gvfs.h" +#include "gvfs-helper-client.h" #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000) @@ -1830,6 +1832,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) } } + if (core_gvfs & GVFS_PREFETCH_DURING_FETCH) + gh_client__prefetch(0, NULL); + if (remote) { if (filter_options.choice || has_promisor_remote()) fetch_one_setup_partial(remote); diff --git a/gvfs.h b/gvfs.h index e193502151467a..7d999f3e8d234f 100644 --- a/gvfs.h +++ b/gvfs.h @@ -17,6 +17,7 @@ #define GVFS_NO_DELETE_OUTSIDE_SPARSECHECKOUT (1 << 3) #define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4) #define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6) +#define GVFS_PREFETCH_DURING_FETCH (1 << 7) void gvfs_load_config_value(const char *value); int gvfs_config_is_set(int mask);