Skip to content

Commit 79e9230

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 <[email protected]>
1 parent 9c1efca commit 79e9230

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
@@ -659,6 +659,10 @@ core.gvfs::
659659
is first accessed and brought down to the client. Git.exe can't
660660
currently tell the first access vs subsequent accesses so this
661661
flag just blocks them from occurring at all.
662+
GVFS_PREFETCH_DURING_FETCH::
663+
Bit value 128
664+
While performing a `git fetch` command, use the gvfs-helper to
665+
perform a "prefetch" of commits and trees.
662666
--
663667

664668
core.useGvfsHelper::

builtin/fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "branch.h"
2828
#include "promisor-remote.h"
2929
#include "commit-graph.h"
30+
#include "gvfs.h"
31+
#include "gvfs-helper-client.h"
3032

3133
#define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
3234

@@ -1821,6 +1823,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
18211823
}
18221824
}
18231825

1826+
if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
1827+
gh_client__prefetch(0, NULL);
1828+
18241829
if (remote) {
18251830
if (filter_options.choice || has_promisor_remote())
18261831
fetch_one_setup_partial(remote);

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)