Skip to content

Commit

Permalink
scalar: only retry a full clone if not using GVFS protocol
Browse files Browse the repository at this point in the history
I found this error in a build, and it was confusing: the call to
set_config() to un-set the partial clone settings failed because those
settings didn't exist. We were in the GVFS protocol case instead. This
will at least give us a clearer reason why such a fetch fails.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Aug 3, 2021
1 parent ee3f6e3 commit d389dce
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions contrib/scalar/scalar.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ static int cmd_clone(int argc, const char **argv)
char *cache_key = NULL, *shared_cache_path = NULL;
struct strbuf buf = STRBUF_INIT;
int res;
int gvfs_protocol;

argc = parse_options(argc, argv, NULL, clone_options, clone_usage, 0);

Expand Down Expand Up @@ -989,8 +990,10 @@ static int cmd_clone(int argc, const char **argv)
goto cleanup;
}

if (cache_server_url ||
supports_gvfs_protocol(url, &default_cache_server_url)) {
gvfs_protocol = cache_server_url ||
supports_gvfs_protocol(url, &default_cache_server_url);

if (gvfs_protocol) {
if (!cache_server_url)
cache_server_url = default_cache_server_url;
if (set_config("core.useGVFSHelper=true") ||
Expand Down Expand Up @@ -1025,7 +1028,12 @@ static int cmd_clone(int argc, const char **argv)
return error(_("could not configure '%s'"), dir);

if ((res = run_git("fetch", "--quiet", "origin", NULL))) {
warning(_("Partial clone failed; Trying full clone"));
if (gvfs_protocol) {
res = error(_("failed to prefetch commits and trees"));
goto cleanup;
}

warning(_("partial clone failed; attempting full clone"));

if (set_config("remote.origin.promisor") ||
set_config("remote.origin.partialCloneFilter")) {
Expand Down

0 comments on commit d389dce

Please sign in to comment.