Skip to content

Commit 521a7f3

Browse files
committed
scalar: only retry a full clone if not using GVFS protocol
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 <[email protected]>
1 parent 2f6565c commit 521a7f3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

contrib/scalar/scalar.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ static int cmd_clone(int argc, const char **argv)
884884
char *cache_key = NULL, *shared_cache_path = NULL;
885885
struct strbuf buf = STRBUF_INIT;
886886
int res;
887+
int gvfs_protocol;
887888

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

@@ -1011,8 +1012,10 @@ static int cmd_clone(int argc, const char **argv)
10111012
goto cleanup;
10121013
}
10131014

1014-
if (cache_server_url ||
1015-
supports_gvfs_protocol(url, &default_cache_server_url)) {
1015+
gvfs_protocol = cache_server_url ||
1016+
supports_gvfs_protocol(url, &default_cache_server_url);
1017+
1018+
if (gvfs_protocol) {
10161019
if (!cache_server_url)
10171020
cache_server_url = default_cache_server_url;
10181021
if (set_config("core.useGVFSHelper=true") ||
@@ -1047,7 +1050,12 @@ static int cmd_clone(int argc, const char **argv)
10471050
return error(_("could not configure '%s'"), dir);
10481051

10491052
if ((res = run_git("fetch", "--quiet", "origin", NULL))) {
1050-
warning(_("Partial clone failed; Trying full clone"));
1053+
if (gvfs_protocol) {
1054+
res = error(_("failed to prefetch commits and trees"));
1055+
goto cleanup;
1056+
}
1057+
1058+
warning(_("partial clone failed; attempting full clone"));
10511059

10521060
if (set_config("remote.origin.promisor") ||
10531061
set_config("remote.origin.partialCloneFilter")) {

0 commit comments

Comments
 (0)