|
34 | 34 | #include "list-objects-filter-options.h" |
35 | 35 | #include "hook.h" |
36 | 36 | #include "bundle.h" |
| 37 | +#include "bundle-uri.h" |
37 | 38 |
|
38 | 39 | /* |
39 | 40 | * Overall FIXMEs: |
@@ -77,6 +78,7 @@ static int option_filter_submodules = -1; /* unspecified */ |
77 | 78 | static int config_filter_submodules = -1; /* unspecified */ |
78 | 79 | static struct string_list server_options = STRING_LIST_INIT_NODUP; |
79 | 80 | static int option_remote_submodules; |
| 81 | +static const char *bundle_uri; |
80 | 82 |
|
81 | 83 | static int recurse_submodules_cb(const struct option *opt, |
82 | 84 | const char *arg, int unset) |
@@ -160,6 +162,8 @@ static struct option builtin_clone_options[] = { |
160 | 162 | N_("any cloned submodules will use their remote-tracking branch")), |
161 | 163 | OPT_BOOL(0, "sparse", &option_sparse_checkout, |
162 | 164 | N_("initialize sparse-checkout file to include only files at root")), |
| 165 | +OPT_STRING(0, "bundle-uri", &bundle_uri, |
| 166 | + N_("uri"), N_("a URI for downloading bundles before fetching from origin remote")), |
163 | 167 | OPT_END() |
164 | 168 | }; |
165 | 169 |
|
@@ -1232,6 +1236,17 @@ int cmd_clone(int argc, const char **argv, const char *prefix) |
1232 | 1236 | if (transport->smart_options && !deepen && !filter_options.choice) |
1233 | 1237 | transport->smart_options->check_self_contained_and_connected = 1; |
1234 | 1238 |
|
| 1239 | +/* |
| 1240 | + * Before fetching from the remote, download and install bundle |
| 1241 | + * data from the --bundle-uri option. |
| 1242 | + */ |
| 1243 | +if (bundle_uri) { |
| 1244 | +/* At this point, we need the_repository to match the cloned repo. */ |
| 1245 | +repo_init(the_repository, git_dir, work_tree); |
| 1246 | +if (fetch_bundle_uri(the_repository, bundle_uri)) |
| 1247 | +warning(_("failed to fetch objects from bundle URI '%s'"), |
| 1248 | +bundle_uri); |
| 1249 | +} |
1235 | 1250 |
|
1236 | 1251 | strvec_push(&transport_ls_refs_options.ref_prefixes, "HEAD"); |
1237 | 1252 | refspec_ref_prefixes(&remote->fetch, |
|
0 commit comments