Skip to content

Automatically create shared-cache directory if necessary #206

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

2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ extern int protect_ntfs;
extern const char *core_fsmonitor;
extern int core_use_gvfs_helper;
extern const char *gvfs_cache_server_url;
extern const char *gvfs_shared_cache_pathname;
extern struct strbuf gvfs_shared_cache_pathname;

int core_apply_sparse_checkout;
int core_sparse_checkout_cone;
Expand Down
12 changes: 5 additions & 7 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1513,19 +1513,17 @@ static int git_default_gvfs_config(const char *var, const char *value)
}

if (!strcmp(var, "gvfs.sharedcache") && value && *value) {
struct strbuf buf = STRBUF_INIT;
strbuf_addstr(&buf, value);
if (strbuf_normalize_path(&buf) < 0) {
strbuf_setlen(&gvfs_shared_cache_pathname, 0);
strbuf_addstr(&gvfs_shared_cache_pathname, value);
if (strbuf_normalize_path(&gvfs_shared_cache_pathname) < 0) {
/*
* Pretend it wasn't set. This will cause us to
* fallback to ".git/objects" effectively.
*/
strbuf_release(&buf);
strbuf_release(&gvfs_shared_cache_pathname);
return 0;
}
strbuf_trim_trailing_dir_sep(&buf);

gvfs_shared_cache_pathname = strbuf_detach(&buf, NULL);
strbuf_trim_trailing_dir_sep(&gvfs_shared_cache_pathname);
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ int protect_ntfs = PROTECT_NTFS_DEFAULT;
const char *core_fsmonitor;
int core_use_gvfs_helper;
const char *gvfs_cache_server_url;
const char *gvfs_shared_cache_pathname;
struct strbuf gvfs_shared_cache_pathname = STRBUF_INIT;

/*
* The character that begins a commented line in user-editable file
Expand Down
6 changes: 3 additions & 3 deletions fetch-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ void fetch_objects(const char *remote_name, const struct object_id *oids,
int i;

if (core_use_gvfs_helper) {
enum ghc__created ghc = GHC__CREATED__NOTHING;
enum gh_client__created ghc = GHC__CREATED__NOTHING;

ghc__queue_oid_array(oids, oid_nr);
ghc__drain_queue(&ghc);
gh_client__queue_oid_array(oids, oid_nr);
gh_client__drain_queue(&ghc);
return;
}

Expand Down
Loading