Skip to content

Commit 6420fd9

Browse files
Kevin Willfordvdye
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>
1 parent 6f092a8 commit 6420fd9

File tree

5 files changed

+42
-0
lines changed

5 files changed

+42
-0
lines changed

Documentation/config/core.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,9 @@ core.multiPackIndex::
728728
single index. See linkgit:git-multi-pack-index[1] for more
729729
information. Defaults to true.
730730

731+
core.gvfs::
732+
Enable the features needed for GVFS.
733+
731734
core.sparseCheckout::
732735
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
733736
for more information.

config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "advice.h"
1111
#include "alloc.h"
1212
#include "date.h"
13+
#include "gvfs.h"
1314
#include "branch.h"
1415
#include "config.h"
1516
#include "convert.h"
@@ -1814,6 +1815,11 @@ int git_default_core_config(const char *var, const char *value, void *cb)
18141815
return 0;
18151816
}
18161817

1818+
if (!strcmp(var, "core.gvfs")) {
1819+
gvfs_load_config_value(value);
1820+
return 0;
1821+
}
1822+
18171823
if (!strcmp(var, "core.sparsecheckout")) {
18181824
core_apply_sparse_checkout = git_config_bool(var, value);
18191825
return 0;

environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ int grafts_replace_parents = 1;
7979
int core_apply_sparse_checkout;
8080
int core_sparse_checkout_cone;
8181
int sparse_expect_files_outside_of_patterns;
82+
int core_gvfs;
8283
int merge_log_config = -1;
8384
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
8485
unsigned long pack_size_limit_cfg;

environment.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int get_shared_repository(void);
145145
void reset_shared_repository(void);
146146

147147
extern int core_preload_index;
148+
extern int core_gvfs;
148149
extern int precomposed_unicode;
149150
extern int protect_hfs;
150151
extern int protect_ntfs;

gvfs.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,40 @@
11
#ifndef GVFS_H
22
#define GVFS_H
33

4+
#include "environment.h"
5+
#include "config.h"
6+
47
/*
58
* This file is for the specific settings and methods
69
* used for GVFS functionality
710
*/
811

12+
static inline int gvfs_config_is_set(int mask) {
13+
return (core_gvfs & mask) == mask;
14+
}
15+
16+
static inline int gvfs_config_is_set_any(void) {
17+
return core_gvfs > 0;
18+
}
19+
20+
static inline void gvfs_load_config_value(const char *value) {
21+
int is_bool = 0;
22+
23+
if (value)
24+
core_gvfs = git_config_bool_or_int("core.gvfs", value, &is_bool);
25+
else
26+
git_config_get_bool_or_int("core.gvfs", &is_bool, &core_gvfs);
27+
28+
/* Turn on all bits if a bool was set in the settings */
29+
if (is_bool && core_gvfs)
30+
core_gvfs = -1;
31+
}
32+
33+
34+
static inline int gvfs_config_load_and_is_set(int mask) {
35+
gvfs_load_config_value(0);
36+
return gvfs_config_is_set(mask);
37+
}
38+
39+
940
#endif /* GVFS_H */

0 commit comments

Comments
 (0)