зеркало из https://github.com/microsoft/git.git
gvfs: optionally skip reachability checks/upload pack during fetch
While performing a fetch with a virtual file system we know that there will be missing objects and we don't want to download them just because of the reachability of the commits. We also don't want to download a pack file with commits, trees, and blobs since these will be downloaded on demand. This flag will skip the first connectivity check and by returning zero will skip the upload pack. It will also skip the second connectivity check but continue to update the branches to the latest commit ids. Signed-off-by: Kevin Willford <kewillf@microsoft.com>
This commit is contained in:
Родитель
c4f195bfdd
Коммит
526552c056
|
@ -765,6 +765,15 @@ core.gvfs::
|
|||
directory. This will allow virtualized working directories to
|
||||
detect the change to HEAD and use the new commit tree to show
|
||||
the files that are in the working directory.
|
||||
GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK::
|
||||
Bit value 16
|
||||
While performing a fetch with a virtual file system we know
|
||||
that there will be missing objects and we don't want to download
|
||||
them just because of the reachability of the commits. We also
|
||||
don't want to download a pack file with commits, trees, and blobs
|
||||
since these will be downloaded on demand. This flag will skip the
|
||||
checks on the reachability of objects during a fetch as well as
|
||||
the upload pack so that extraneous objects don't get downloaded.
|
||||
--
|
||||
|
||||
core.sparseCheckout::
|
||||
|
|
19
connected.c
19
connected.c
|
@ -1,6 +1,7 @@
|
|||
#include "git-compat-util.h"
|
||||
#include "gettext.h"
|
||||
#include "hex.h"
|
||||
#include "gvfs.h"
|
||||
#include "object-store-ll.h"
|
||||
#include "run-command.h"
|
||||
#include "sigchain.h"
|
||||
|
@ -32,6 +33,24 @@ int check_connected(oid_iterate_fn fn, void *cb_data,
|
|||
struct transport *transport;
|
||||
size_t base_len;
|
||||
|
||||
/*
|
||||
* Running a virtual file system there will be objects that are
|
||||
* missing locally and we don't want to download a bunch of
|
||||
* commits, trees, and blobs just to make sure everything is
|
||||
* reachable locally so this option will skip reachablility
|
||||
* checks below that use rev-list. This will stop the check
|
||||
* before uploadpack runs to determine if there is anything to
|
||||
* fetch. Returning zero for the first check will also prevent the
|
||||
* uploadpack from happening. It will also skip the check after
|
||||
* the fetch is finished to make sure all the objects where
|
||||
* downloaded in the pack file. This will allow the fetch to
|
||||
* run and get all the latest tip commit ids for all the branches
|
||||
* in the fetch but not pull down commits, trees, or blobs via
|
||||
* upload pack.
|
||||
*/
|
||||
if (gvfs_config_is_set(GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK))
|
||||
return 0;
|
||||
|
||||
if (!opt)
|
||||
opt = &defaults;
|
||||
transport = opt->transport;
|
||||
|
|
1
gvfs.h
1
gvfs.h
|
@ -14,6 +14,7 @@
|
|||
#define GVFS_SKIP_SHA_ON_INDEX (1 << 0)
|
||||
#define GVFS_MISSING_OK (1 << 2)
|
||||
#define GVFS_NO_DELETE_OUTSIDE_SPARSECHECKOUT (1 << 3)
|
||||
#define GVFS_FETCH_SKIP_REACHABILITY_AND_UPLOADPACK (1 << 4)
|
||||
|
||||
void gvfs_load_config_value(const char *value);
|
||||
int gvfs_config_is_set(int mask);
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='fetch using the flag to skip reachability and upload pack'
|
||||
|
||||
. ./test-lib.sh
|
||||
|
||||
|
||||
test_expect_success setup '
|
||||
echo inital >a &&
|
||||
git add a &&
|
||||
git commit -m initial &&
|
||||
git clone . one
|
||||
'
|
||||
|
||||
test_expect_success "fetch test" '
|
||||
cd one &&
|
||||
git config core.gvfs 16 &&
|
||||
rm -rf .git/objects/* &&
|
||||
git -C .. cat-file commit HEAD | git hash-object -w --stdin -t commit &&
|
||||
git fetch &&
|
||||
test_must_fail git rev-parse --verify HEAD^{tree}
|
||||
'
|
||||
|
||||
test_done
|
Загрузка…
Ссылка в новой задаче