Skip to content

Commit d5ce986

Browse files
Kevin Willfordderrickstolee
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 056ca18 commit d5ce986

5 files changed

Lines changed: 42 additions & 0 deletions

File tree

Documentation/config/core.txt

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

716+
core.gvfs::
717+
Enable the features needed for GVFS.
718+
716719
core.sparseCheckout::
717720
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
718721
for more information.

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ enum fsync_method {
10761076

10771077
extern enum fsync_method fsync_method;
10781078
extern int core_preload_index;
1079+
extern int core_gvfs;
10791080
extern int precomposed_unicode;
10801081
extern int protect_hfs;
10811082
extern int protect_ntfs;

config.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
#include "cache.h"
99
#include "date.h"
10+
#include "gvfs.h"
1011
#include "branch.h"
1112
#include "config.h"
1213
#include "environment.h"
@@ -1717,6 +1718,11 @@ int git_default_core_config(const char *var, const char *value, void *cb)
17171718
return 0;
17181719
}
17191720

1721+
if (!strcmp(var, "core.gvfs")) {
1722+
gvfs_load_config_value(value);
1723+
return 0;
1724+
}
1725+
17201726
if (!strcmp(var, "core.sparsecheckout")) {
17211727
core_apply_sparse_checkout = git_config_bool(var, value);
17221728
return 0;

environment.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ int grafts_replace_parents = 1;
7373
int core_apply_sparse_checkout;
7474
int core_sparse_checkout_cone;
7575
int sparse_expect_files_outside_of_patterns;
76+
int core_gvfs;
7677
int merge_log_config = -1;
7778
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
7879
unsigned long pack_size_limit_cfg;

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 "cache.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)