Skip to content

Commit cd85c6e

Browse files
derrickstoleevdye
authored andcommitted
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 <dstolee@microsoft.com>
1 parent 2752a54 commit cd85c6e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Documentation/config/core.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,10 @@ core.gvfs::
776776
is first accessed and brought down to the client. Git.exe can't
777777
currently tell the first access vs subsequent accesses so this
778778
flag just blocks them from occurring at all.
779+
GVFS_PREFETCH_DURING_FETCH::
780+
Bit value 128
781+
While performing a `git fetch` command, use the gvfs-helper to
782+
perform a "prefetch" of commits and trees.
779783
--
780784

781785
core.useGvfsHelper::

builtin/fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include "string-list.h"
2020
#include "remote.h"
2121
#include "transport.h"
22+
#include "gvfs.h"
23+
#include "gvfs-helper-client.h"
2224
#include "run-command.h"
2325
#include "parse-options.h"
2426
#include "sigchain.h"
@@ -2358,6 +2360,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
23582360
}
23592361
string_list_remove_duplicates(&list, 0);
23602362

2363+
if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
2364+
gh_client__prefetch(0, NULL);
2365+
23612366
if (negotiate_only) {
23622367
struct oidset acked_commits = OIDSET_INIT;
23632368
struct oidset_iter iter;

gvfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4)
3030
#define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6)
31+
#define GVFS_PREFETCH_DURING_FETCH (1 << 7)
3132

3233
void gvfs_load_config_value(const char *value);
3334
int gvfs_config_is_set(int mask);

0 commit comments

Comments
 (0)