From 256ecf2828d0762f81f735f9b982697afaef55bd Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 17 Dec 2019 07:25:40 -0500 Subject: [PATCH] fetch: use gvfs-helper prefetch under config The gvfs-helper allows us to download prefetch packs using a simple subprocess call. The gvfs-helper-client.h method will automatically compute the timestamp if passing 0, and passing NULL for the number of downloaded packs is valid. Signed-off-by: Derrick Stolee --- Documentation/config/core.txt | 4 ++++ builtin/fetch.c | 5 +++++ gvfs.h | 1 + 3 files changed, 10 insertions(+) diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt index 5ea5f7a762b1fa..1e8d0c0bc7fe2c 100644 --- a/Documentation/config/core.txt +++ b/Documentation/config/core.txt @@ -776,6 +776,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 3aecbe4a3deb25..d8e907afe6e110 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -13,6 +13,8 @@ #include "string-list.h" #include "remote.h" #include "transport.h" +#include "gvfs.h" +#include "gvfs-helper-client.h" #include "run-command.h" #include "parse-options.h" #include "sigchain.h" @@ -2219,6 +2221,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 (negotiate_only) { struct oidset acked_commits = OIDSET_INIT; struct oidset_iter iter; 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);