Skip to content

Commit bff999f

Browse files
committed
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 dbebe4a commit bff999f

3 files changed

Lines changed: 10 additions & 0 deletions

File tree

Documentation/config/core.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,10 @@ core.gvfs::
761761
is first accessed and brought down to the client. Git.exe can't
762762
currently tell the first access vs subsequent accesses so this
763763
flag just blocks them from occurring at all.
764+
GVFS_PREFETCH_DURING_FETCH::
765+
Bit value 128
766+
While performing a `git fetch` command, use the gvfs-helper to
767+
perform a "prefetch" of commits and trees.
764768
--
765769

766770
core.useGvfsHelper::

builtin/fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "string-list.h"
1414
#include "remote.h"
1515
#include "transport.h"
16+
#include "gvfs.h"
17+
#include "gvfs-helper-client.h"
1618
#include "run-command.h"
1719
#include "parse-options.h"
1820
#include "sigchain.h"
@@ -2217,6 +2219,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
22172219
}
22182220
}
22192221

2222+
if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
2223+
gh_client__prefetch(0, NULL);
2224+
22202225
if (negotiate_only) {
22212226
struct oidset acked_commits = OIDSET_INIT;
22222227
struct oidset_iter iter;

gvfs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define GVFS_NO_DELETE_OUTSIDE_SPARSECHECKOUT (1 << 3)
1818
#define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4)
1919
#define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6)
20+
#define GVFS_PREFETCH_DURING_FETCH (1 << 7)
2021

2122
void gvfs_load_config_value(const char *value);
2223
int gvfs_config_is_set(int mask);

0 commit comments

Comments
 (0)