Skip to content

Commit 41e4d0c

Browse files
derrickstoleedscho
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 afdd8ea commit 41e4d0c

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

Diff for: Documentation/config/core.txt

+4
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,10 @@ core.gvfs::
791791
is first accessed and brought down to the client. Git.exe can't
792792
currently tell the first access vs subsequent accesses so this
793793
flag just blocks them from occurring at all.
794+
GVFS_PREFETCH_DURING_FETCH::
795+
Bit value 128
796+
While performing a `git fetch` command, use the gvfs-helper to
797+
perform a "prefetch" of commits and trees.
794798
--
795799

796800
core.useGvfsHelper::

Diff for: builtin/fetch.c

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "string-list.h"
2222
#include "remote.h"
2323
#include "transport.h"
24+
#include "gvfs.h"
25+
#include "gvfs-helper-client.h"
2426
#include "run-command.h"
2527
#include "parse-options.h"
2628
#include "sigchain.h"
@@ -2550,6 +2552,9 @@ int cmd_fetch(int argc,
25502552
}
25512553
string_list_remove_duplicates(&list, 0);
25522554

2555+
if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
2556+
gh_client__prefetch(0, NULL);
2557+
25532558
if (negotiate_only) {
25542559
struct oidset acked_commits = OIDSET_INIT;
25552560
struct oidset_iter iter;

Diff for: gvfs.h

+1
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)