Skip to content

Commit 3f134ac

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 <[email protected]>
1 parent 73c4abc commit 3f134ac

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Documentation/config/core.adoc

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

795799
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"
@@ -2286,7 +2288,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv,
22862288
int cmd_fetch(int argc,
22872289
const char **argv,
22882290
const char *prefix,
2289-
struct repository *repo UNUSED)
2291+
struct repository *repo)
22902292
{
22912293
struct fetch_config config = {
22922294
.display_format = DISPLAY_FORMAT_FULL,
@@ -2557,6 +2559,9 @@ int cmd_fetch(int argc,
25572559
}
25582560
string_list_remove_duplicates(&list, 0);
25592561

2562+
if (gvfs_config_is_set(repo, GVFS_PREFETCH_DURING_FETCH))
2563+
gh_client__prefetch(0, NULL);
2564+
25602565
if (negotiate_only) {
25612566
struct oidset acked_commits = OIDSET_INIT;
25622567
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)