Skip to content

gvfs: allow overriding core.gvfs #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions gvfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ static int early_core_gvfs_config(const char *var, const char *value, void *data

void gvfs_load_config_value(const char *value)
{
if (gvfs_config_loaded)
return;

if (value)
core_gvfs = git_config_bool_or_int("core.gvfs", value, &core_gvfs_is_bool);
else if (startup_info->have_repository == 0)
Expand All @@ -27,12 +24,13 @@ void gvfs_load_config_value(const char *value)
/* 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(0);
if (!gvfs_config_loaded)
gvfs_load_config_value(0);

gvfs_config_loaded = 1;
return (core_gvfs & mask) == mask;
}
4 changes: 4 additions & 0 deletions t/t0021-conversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,10 @@ test_expect_success "filter: smudge filters blocked when under GVFS" '
test_config filter.empty-in-repo.smudge "echo smudged && cat" &&
test_config core.gvfs 64 &&

test_must_fail git checkout &&

# ensure the local core.gvfs setting overwrites the global setting
git config --global core.gvfs false &&
test_must_fail git checkout
'

Expand Down