Skip to content

Commit

Permalink
gvfs: add the core.gvfs config setting
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kevin Willford authored and dscho committed Aug 11, 2023
1 parent 36494d9 commit 621dc53
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/config/core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,9 @@ core.multiPackIndex::
single index. See linkgit:git-multi-pack-index[1] for more
information. Defaults to true.

core.gvfs::
Enable the features needed for GVFS.

core.sparseCheckout::
Enable "sparse checkout" feature. See linkgit:git-sparse-checkout[1]
for more information.
Expand Down
6 changes: 6 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "abspath.h"
#include "advice.h"
#include "date.h"
#include "gvfs.h"
#include "branch.h"
#include "config.h"
#include "convert.h"
Expand Down Expand Up @@ -1776,6 +1777,11 @@ int git_default_core_config(const char *var, const char *value,
return 0;
}

if (!strcmp(var, "core.gvfs")) {
gvfs_load_config_value(value);
return 0;
}

if (!strcmp(var, "core.sparsecheckout")) {
core_apply_sparse_checkout = git_config_bool(var, value);
return 0;
Expand Down
1 change: 1 addition & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ int grafts_keep_true_parents;
int core_apply_sparse_checkout;
int core_sparse_checkout_cone;
int sparse_expect_files_outside_of_patterns;
int core_gvfs;
int merge_log_config = -1;
int precomposed_unicode = -1; /* see probe_utf8_pathname_composition() */
unsigned long pack_size_limit_cfg;
Expand Down
1 change: 1 addition & 0 deletions environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ int get_shared_repository(void);
void reset_shared_repository(void);

extern int core_preload_index;
extern int core_gvfs;
extern int precomposed_unicode;
extern int protect_hfs;
extern int protect_ntfs;
Expand Down
31 changes: 31 additions & 0 deletions gvfs.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,40 @@
#ifndef GVFS_H
#define GVFS_H

#include "environment.h"
#include "config.h"

/*
* This file is for the specific settings and methods
* used for GVFS functionality
*/

static inline int gvfs_config_is_set(int mask) {
return (core_gvfs & mask) == mask;
}

static inline int gvfs_config_is_set_any(void) {
return core_gvfs > 0;
}

static inline void gvfs_load_config_value(const char *value) {
int is_bool = 0;

if (value)
core_gvfs = git_config_bool_or_int("core.gvfs", value, &is_bool);
else
git_config_get_bool_or_int("core.gvfs", &is_bool, &core_gvfs);

/* Turn on all bits if a bool was set in the settings */
if (is_bool && core_gvfs)
core_gvfs = -1;
}


static inline int gvfs_config_load_and_is_set(int mask) {
gvfs_load_config_value(0);
return gvfs_config_is_set(mask);
}


#endif /* GVFS_H */

0 comments on commit 621dc53

Please sign in to comment.