Skip to content

Commit 52ef3e1

Browse files
derrickstoleedscho
authored andcommitted
Merge pull request #228: "gvfs-helper prefetch" during "git fetch"
This is a follow-up to #227. 1. When a new flag is added to our Git config, we can run `gvfs-helper prefetch` inside of our `git fetch` calls. This will help ensure we have updated commits and trees even if the background prefetches have fallen behind (or are not running). 2. With a new `--no-update-remote-refs` we can avoid updating the `refs/remotes` namespace. This will allow us to run `git fetch --all --no-update-remote-refs +refs/heads/*:refs/hidden/*` and we will get the new refs into a local folder (that doesn't appear anywhere). The most important thing is that users will still see when their remote refs update.
2 parents f7a9dce + 33259e4 commit 52ef3e1

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
@@ -670,6 +670,10 @@ core.gvfs::
670670
is first accessed and brought down to the client. Git.exe can't
671671
currently tell the first access vs subsequent accesses so this
672672
flag just blocks them from occurring at all.
673+
GVFS_PREFETCH_DURING_FETCH::
674+
Bit value 128
675+
While performing a `git fetch` command, use the gvfs-helper to
676+
perform a "prefetch" of commits and trees.
673677
--
674678

675679
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"
@@ -1823,6 +1825,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
18231825
}
18241826
}
18251827

1828+
if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
1829+
gh_client__prefetch(0, NULL);
1830+
18261831
if (remote) {
18271832
if (filter_options.choice || has_promisor_remote())
18281833
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)