зеркало из https://github.com/microsoft/git.git
gvfs: add the feature to skip writing the index' SHA-1
This takes a substantial amount of time, and if the user is reasonably sure that the files' integrity is not compromised, that time can be saved. Git no longer verifies the SHA-1 by default, anyway. Signed-off-by: Kevin Willford <kewillf@microsoft.com> Update for 2023-02-27: This feature was upstreamed as the index.skipHash config option. This resulted in some changes to the struct and some of the setup code. In particular, the config reading was moved to prepare_repo_settings(), so the core.gvfs bit check was moved there, too. Signed-off-by: Derrick Stolee <derrickstolee@github.com>
This commit is contained in:
Родитель
4d672dfb63
Коммит
a4b9a71941
|
@ -744,7 +744,15 @@ core.multiPackIndex::
|
|||
information. Defaults to true.
|
||||
|
||||
core.gvfs::
|
||||
Enable the features needed for GVFS.
|
||||
Enable the features needed for GVFS. This value can be set to true
|
||||
to indicate all features should be turned on or the bit values listed
|
||||
below can be used to turn on specific features.
|
||||
+
|
||||
--
|
||||
GVFS_SKIP_SHA_ON_INDEX::
|
||||
Bit value 1
|
||||
Disables the calculation of the sha when writing the index
|
||||
--
|
||||
|
||||
core.sparseCheckout::
|
||||
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
|
||||
|
|
6
gvfs.h
6
gvfs.h
|
@ -7,6 +7,12 @@
|
|||
* used for GVFS functionality
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The list of bits in the core_gvfs setting
|
||||
*/
|
||||
#define GVFS_SKIP_SHA_ON_INDEX (1 << 0)
|
||||
|
||||
void gvfs_load_config_value(const char *value);
|
||||
int gvfs_config_is_set(int mask);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "midx.h"
|
||||
#include "fsmonitor-ipc.h"
|
||||
#include "fsmonitor-settings.h"
|
||||
#include "gvfs.h"
|
||||
|
||||
static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
|
||||
int def)
|
||||
|
@ -95,6 +96,13 @@ void prepare_repo_settings(struct repository *r)
|
|||
r->settings.pack_use_bitmap_boundary_traversal);
|
||||
repo_cfg_bool(r, "core.usereplacerefs", &r->settings.read_replace_refs, 1);
|
||||
|
||||
/*
|
||||
* For historical compatibility reasons, enable index.skipHash based
|
||||
* on a bit in core.gvfs.
|
||||
*/
|
||||
if (gvfs_config_is_set(GVFS_SKIP_SHA_ON_INDEX))
|
||||
r->settings.index_skip_hash = 1;
|
||||
|
||||
/*
|
||||
* The GIT_TEST_MULTI_PACK_INDEX variable is special in that
|
||||
* either it *or* the config sets
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/sh
|
||||
|
||||
test_description='check that read-tree works with core.gvfs config value'
|
||||
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-read-tree.sh
|
||||
|
||||
test_expect_success setup '
|
||||
echo one >a &&
|
||||
git add a &&
|
||||
git commit -m initial
|
||||
'
|
||||
test_expect_success 'read-tree without core.gvsf' '
|
||||
read_tree_u_must_succeed -m -u HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'read-tree with core.gvfs set to 1' '
|
||||
git config core.gvfs 1 &&
|
||||
read_tree_u_must_succeed -m -u HEAD
|
||||
'
|
||||
|
||||
test_done
|
Загрузка…
Ссылка в новой задаче