| 193 | } |
| 194 | |
| 195 | static int cmd_bundle_unbundle(int argc, const char **argv, const char *prefix, |
| 196 | struct repository *repo UNUSED) { |
| 197 | struct bundle_header header = BUNDLE_HEADER_INIT; |
| 198 | int bundle_fd = -1; |
| 199 | int ret; |
| 200 | int progress = isatty(2); |
| 201 | |
| 202 | struct option options[] = { |
| 203 | OPT_BOOL(0, "progress", &progress, |
| 204 | N_("show progress meter")), |
| 205 | OPT_END() |
| 206 | }; |
| 207 | char *bundle_file; |
| 208 | struct strvec extra_index_pack_args = STRVEC_INIT; |
| 209 | |
| 210 | argc = parse_options_cmd_bundle(argc, argv, prefix, |
| 211 | builtin_bundle_unbundle_usage, options, &bundle_file); |
| 212 | /* bundle internals use argv[1] as further parameters */ |
| 213 | |
| 214 | if (!startup_info->have_repository) |
| 215 | die(_("Need a repository to unbundle.")); |
| 216 | |
| 217 | if ((bundle_fd = open_bundle(bundle_file, &header, NULL)) < 0) { |
| 218 | ret = 1; |
| 219 | goto cleanup; |
| 220 | } |
| 221 | if (progress) |
| 222 | strvec_pushl(&extra_index_pack_args, "-v", "--progress-title", |
| 223 | _("Unbundling objects"), NULL); |
| 224 | ret = !!unbundle(the_repository, &header, bundle_fd, |
| 225 | &extra_index_pack_args, NULL) || |
| 226 | list_bundle_refs(&header, argc, argv); |
| 227 | bundle_header_release(&header); |
| 228 | |
| 229 | cleanup: |
| 230 | strvec_clear(&extra_index_pack_args); |
| 231 | free(bundle_file); |
| 232 | return ret; |
| 233 | } |
| 234 | |
| 235 | int cmd_bundle(int argc, |
| 236 | const char **argv, |
nothing calls this directly
no test coverage detected