forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> 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 <[email protected]>
- Loading branch information
Showing
7 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "git-compat-util.h" | ||
#include "environment.h" | ||
#include "gvfs.h" | ||
#include "setup.h" | ||
#include "config.h" | ||
|
||
static int gvfs_config_loaded; | ||
static int core_gvfs_is_bool; | ||
|
||
static int early_core_gvfs_config(const char *var, const char *value, | ||
const struct config_context *ctx, void *cb) | ||
{ | ||
if (!strcmp(var, "core.gvfs")) | ||
core_gvfs = git_config_bool_or_int("core.gvfs", value, ctx->kvi, | ||
&core_gvfs_is_bool); | ||
return 0; | ||
} | ||
|
||
void gvfs_load_config_value(const char *value) | ||
{ | ||
if (gvfs_config_loaded) | ||
return; | ||
|
||
if (value) { | ||
struct key_value_info default_kvi = KVI_INIT; | ||
core_gvfs = git_config_bool_or_int("core.gvfs", value, &default_kvi, &core_gvfs_is_bool); | ||
} else if (startup_info->have_repository == 0) | ||
read_early_config(early_core_gvfs_config, NULL); | ||
else | ||
repo_config_get_bool_or_int(the_repository, "core.gvfs", | ||
&core_gvfs_is_bool, &core_gvfs); | ||
|
||
/* Turn on all bits if a bool was set in the settings */ | ||
if (core_gvfs_is_bool && core_gvfs) | ||
core_gvfs = -1; | ||
|
||
gvfs_config_loaded = 1; | ||
} | ||
|
||
int gvfs_config_is_set(int mask) | ||
{ | ||
gvfs_load_config_value(NULL); | ||
return (core_gvfs & mask) == mask; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
#ifndef GVFS_H | ||
#define GVFS_H | ||
|
||
|
||
/* | ||
* This file is for the specific settings and methods | ||
* used for GVFS functionality | ||
*/ | ||
|
||
void gvfs_load_config_value(const char *value); | ||
int gvfs_config_is_set(int mask); | ||
|
||
#endif /* GVFS_H */ |