Skip to content

Commit 29e468a

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 8ed3089 commit 29e468a

3 files changed

Lines changed: 11 additions & 1 deletion

File tree

‎Documentation/config/core.adoc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,10 @@ core.gvfs::
810810
is first accessed and brought down to the client. Git.exe can't
811811
currently tell the first access vs subsequent accesses so this
812812
flag just blocks them from occurring at all.
813+
GVFS_PREFETCH_DURING_FETCH::
814+
Bit value 128
815+
While performing a `git fetch` command, use the gvfs-helper to
816+
perform a "prefetch" of commits and trees.
813817
--
814818

815819
core.useGvfsHelper::

‎builtin/fetch.c‎

Lines changed: 6 additions & 1 deletion
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"
@@ -2315,7 +2317,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv,
23152317
int cmd_fetch(int argc,
23162318
const char **argv,
23172319
const char *prefix,
2318-
struct repository *repo UNUSED)
2320+
struct repository *repo)
23192321
{
23202322
struct fetch_config config = {
23212323
.display_format = DISPLAY_FORMAT_FULL,
@@ -2586,6 +2588,9 @@ int cmd_fetch(int argc,
25862588
}
25872589
string_list_remove_duplicates(&list, 0);
25882590

2591+
if (gvfs_config_is_set(repo, GVFS_PREFETCH_DURING_FETCH))
2592+
gh_client__prefetch(0, NULL);
2593+
25892594
if (negotiate_only) {
25902595
struct oidset acked_commits = OIDSET_INIT;
25912596
struct oidset_iter iter;

‎gvfs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct repository;
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
int gvfs_config_is_set(struct repository *r, int mask);
3334
int gvfs_virtualize_objects(struct repository *r);

0 commit comments

Comments
 (0)