Skip to content

Commit

Permalink
Merge pull request #228: "gvfs-helper prefetch" during "git fetch"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
derrickstolee committed Mar 17, 2020
2 parents 6c47c41 + ef3cf46 commit 0a60e9c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Documentation/config/core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ core.gvfs::
is first accessed and brought down to the client. Git.exe can't
currently tell the first access vs subsequent accesses so this
flag just blocks them from occurring at all.
GVFS_PREFETCH_DURING_FETCH::
Bit value 128
While performing a `git fetch` command, use the gvfs-helper to
perform a "prefetch" of commits and trees.
--

core.useGvfsHelper::
Expand Down
5 changes: 5 additions & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "branch.h"
#include "promisor-remote.h"
#include "commit-graph.h"
#include "gvfs.h"
#include "gvfs-helper-client.h"

#define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)

Expand Down Expand Up @@ -1830,6 +1832,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
}
}

if (core_gvfs & GVFS_PREFETCH_DURING_FETCH)
gh_client__prefetch(0, NULL);

if (remote) {
if (filter_options.choice || has_promisor_remote())
fetch_one_setup_partial(remote);
Expand Down
1 change: 1 addition & 0 deletions gvfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define GVFS_NO_DELETE_OUTSIDE_SPARSECHECKOUT (1 << 3)
#define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4)
#define GVFS_BLOCK_FILTERS_AND_EOL_CONVERSIONS (1 << 6)
#define GVFS_PREFETCH_DURING_FETCH (1 << 7)

void gvfs_load_config_value(const char *value);
int gvfs_config_is_set(int mask);
Expand Down

0 comments on commit 0a60e9c

Please sign in to comment.