]> git.ipfire.org Git - thirdparty/git.git/commitdiff
clone: warn on failure to repo_init()
authorDerrick Stolee <derrickstolee@github.com>
Tue, 23 Aug 2022 14:05:13 +0000 (10:05 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 24 Aug 2022 15:46:36 +0000 (08:46 -0700)
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>
builtin/clone.c

index 4463789680bdb901993eb6f74fd9932dae4e7c36..e21d42dfee54338c4beba9431b469d1f285c0bdf 100644 (file)
@@ -1245,8 +1245,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
         */
        if (bundle_uri) {
                /* At this point, we need the_repository to match the cloned repo. */
-               repo_init(the_repository, git_dir, work_tree);
-               if (fetch_bundle_uri(the_repository, bundle_uri))
+               if (repo_init(the_repository, git_dir, work_tree))
+                       warning(_("failed to initialize the repo, skipping bundle URI"));
+               else if (fetch_bundle_uri(the_repository, bundle_uri))
                        warning(_("failed to fetch objects from bundle URI '%s'"),
                                bundle_uri);
        }