Skip to content

Commit be3b3ac

Browse files
Kevin Willforddscho
Kevin Willford
authored andcommitted
gvfs: add the core.gvfs config setting
This does not do anything yet. The next patches will add various values for that config setting that correspond to the various features offered/required by GVFS. Signed-off-by: Kevin Willford <kewillf@microsoft.com> gvfs: refactor loading the core.gvfs config value This code change makes sure that the config value for core_gvfs is always loaded before checking it. Signed-off-by: Kevin Willford <kewillf@microsoft.com>
1 parent afa9508 commit be3b3ac

File tree

8 files changed

+62
-0
lines changed

8 files changed

+62
-0
lines changed

Diff for: Documentation/config/core.txt

+3
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@ core.multiPackIndex::
743743
single index. See linkgit:git-multi-pack-index[1] for more
744744
information. Defaults to true.
745745

746+
core.gvfs::
747+
Enable the features needed for GVFS.
748+
746749
core.sparseCheckout::
747750
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
748751
for more information.

Diff for: Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ LIB_OBJS += git-zlib.o
10381038
LIB_OBJS += gpg-interface.o
10391039
LIB_OBJS += graph.o
10401040
LIB_OBJS += grep.o
1041+
LIB_OBJS += gvfs.o
10411042
LIB_OBJS += hash-lookup.o
10421043
LIB_OBJS += hashmap.o
10431044
LIB_OBJS += help.o

Diff for: config.c

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "abspath.h"
1414
#include "advice.h"
1515
#include "date.h"
16+
#include "gvfs.h"
1617
#include "branch.h"
1718
#include "config.h"
1819
#include "parse.h"
@@ -1621,6 +1622,11 @@ int git_default_core_config(const char *var, const char *value,
16211622
return 0;
16221623
}
16231624

1625+
if (!strcmp(var, "core.gvfs")) {
1626+
gvfs_load_config_value(value);
1627+
return 0;
1628+
}
1629+
16241630
if (!strcmp(var, "core.sparsecheckout")) {
16251631
core_apply_sparse_checkout = git_config_bool(var, value);
16261632
return 0;

Diff for: environment.c

+1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ int grafts_keep_true_parents;
6868
int core_apply_sparse_checkout;
6969
int core_sparse_checkout_cone;
7070
int sparse_expect_files_outside_of_patterns;
71+
int core_gvfs;
7172
int merge_log_config = -1;
7273
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
7374
unsigned long pack_size_limit_cfg;

Diff for: environment.h

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ extern unsigned long pack_size_limit_cfg;
170170
extern int max_allowed_tree_depth;
171171

172172
extern int core_preload_index;
173+
extern int core_gvfs;
173174
extern int precomposed_unicode;
174175
extern int protect_hfs;
175176
extern int protect_ntfs;

Diff for: gvfs.c

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#define USE_THE_REPOSITORY_VARIABLE
2+
#include "git-compat-util.h"
3+
#include "environment.h"
4+
#include "gvfs.h"
5+
#include "setup.h"
6+
#include "config.h"
7+
8+
static int gvfs_config_loaded;
9+
static int core_gvfs_is_bool;
10+
11+
static int early_core_gvfs_config(const char *var, const char *value,
12+
const struct config_context *ctx, void *cb UNUSED)
13+
{
14+
if (!strcmp(var, "core.gvfs"))
15+
core_gvfs = git_config_bool_or_int("core.gvfs", value, ctx->kvi,
16+
&core_gvfs_is_bool);
17+
return 0;
18+
}
19+
20+
void gvfs_load_config_value(const char *value)
21+
{
22+
if (gvfs_config_loaded)
23+
return;
24+
25+
if (value) {
26+
struct key_value_info default_kvi = KVI_INIT;
27+
core_gvfs = git_config_bool_or_int("core.gvfs", value, &default_kvi, &core_gvfs_is_bool);
28+
} else if (startup_info->have_repository == 0)
29+
read_early_config(the_repository, early_core_gvfs_config, NULL);
30+
else
31+
repo_config_get_bool_or_int(the_repository, "core.gvfs",
32+
&core_gvfs_is_bool, &core_gvfs);
33+
34+
/* Turn on all bits if a bool was set in the settings */
35+
if (core_gvfs_is_bool && core_gvfs)
36+
core_gvfs = -1;
37+
38+
gvfs_config_loaded = 1;
39+
}
40+
41+
int gvfs_config_is_set(int mask)
42+
{
43+
gvfs_load_config_value(NULL);
44+
return (core_gvfs & mask) == mask;
45+
}

Diff for: gvfs.h

+4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
#ifndef GVFS_H
22
#define GVFS_H
33

4+
45
/*
56
* This file is for the specific settings and methods
67
* used for GVFS functionality
78
*/
89

10+
void gvfs_load_config_value(const char *value);
11+
int gvfs_config_is_set(int mask);
12+
913
#endif /* GVFS_H */

Diff for: meson.build

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ libgit_sources = [
294294
'gpg-interface.c',
295295
'graph.c',
296296
'grep.c',
297+
'gvfs.c',
297298
'hash-lookup.c',
298299
'hashmap.c',
299300
'help.c',

0 commit comments

Comments
 (0)