clone: warn on failure to repo_init()

The --bundle-uri option was added in 55568919616 (clone: add --bundle-uri option, 2022-08-09), but this also introduced a call to repo_init() whose return value was ignored. Fix that ignored value by warning that the bundle URI process could not continue if it failed. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Aug 23, 2022 at 10:05 UTC 65da93891680edc0d1471d436d92d4da7d0b4465
1 file changed +3 -2
builtin/clone.c
+3 -2
@@ -1245,8 +1245,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
1245 */
1246 if (bundle_uri) {
1247 /* At this point, we need the_repository to match the cloned repo. */
1248 - repo_init(the_repository, git_dir, work_tree);
1249 - if (fetch_bundle_uri(the_repository, bundle_uri))
1248 + if (repo_init(the_repository, git_dir, work_tree))
1249 + warning(_("failed to initialize the repo, skipping bundle URI"));
1250 + else if (fetch_bundle_uri(the_repository, bundle_uri))
1251 warning(_("failed to fetch objects from bundle URI '%s'"),
1252 bundle_uri);
1253 }