Skip to content
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

gvfs-helper: add gvfs.fallback config option #664

Closed
Closed
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
5 changes: 5 additions & 0 deletions Documentation/config/gvfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ gvfs.cache-server::

gvfs.sharedcache::
TODO

gvfs.fallback::
If set to `false`, then never fallback to the origin server when the cache
server fails to connect. This will alert users to failures with the cache
server, but avoid causing throttling on the origin server.
11 changes: 10 additions & 1 deletion gvfs-helper-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "pkt-line.h"
#include "quote.h"
#include "packfile.h"
#include "config.h"

static struct oidset gh_client__oidset_queued = OIDSET_INIT;
static unsigned long gh_client__oidset_count;
Expand Down Expand Up @@ -337,17 +338,25 @@ static struct gh_server__process *gh_client__find_long_running_process(
struct gh_server__process *entry;
struct strvec argv = STRVEC_INIT;
struct strbuf quoted = STRBUF_INIT;
int fallback;

gh_client__choose_odb();

/*
* TODO decide what defaults we want.
*/
strvec_push(&argv, "gvfs-helper");
strvec_push(&argv, "--fallback");
strvec_push(&argv, "--cache-server=trust");
strvec_pushf(&argv, "--shared-cache=%s",
gh_client__chosen_odb->path);

/* If gvfs.fallback=false, then don't add --fallback. */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be easier to just hack gvfs-helper.exe to lookup that config value ??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be too magic, though. And so far, gvfs-helper only uses git_config(git_default_config), no custom config variables there.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d'oh, nevermind.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, the client passes --fallback to the server directly, which would normally override any config option.

if (!git_config_get_bool("gvfs.fallback", &fallback) &&
!fallback)
strvec_push(&argv, "--no-fallback");
else
strvec_push(&argv, "--fallback");

strvec_push(&argv, "server");

sq_quote_argv_pretty(&quoted, argv.v);
Expand Down
Loading