| 125 | } |
| 126 | |
| 127 | static int cmd_bundle_verify(int argc, const char **argv, const char *prefix, |
| 128 | struct repository *repo UNUSED) { |
| 129 | struct bundle_header header = BUNDLE_HEADER_INIT; |
| 130 | int bundle_fd = -1; |
| 131 | int quiet = 0; |
| 132 | int ret; |
| 133 | struct option options[] = { |
| 134 | OPT_BOOL('q', "quiet", &quiet, |
| 135 | N_("do not show bundle details")), |
| 136 | OPT_END() |
| 137 | }; |
| 138 | char *bundle_file; |
| 139 | const char *name; |
| 140 | |
| 141 | argc = parse_options_cmd_bundle(argc, argv, prefix, |
| 142 | builtin_bundle_verify_usage, options, &bundle_file); |
| 143 | /* bundle internals use argv[1] as further parameters */ |
| 144 | |
| 145 | if (!startup_info->have_repository) { |
| 146 | ret = error(_("need a repository to verify a bundle")); |
| 147 | goto cleanup; |
| 148 | } |
| 149 | |
| 150 | if ((bundle_fd = open_bundle(bundle_file, &header, &name)) < 0) { |
| 151 | ret = 1; |
| 152 | goto cleanup; |
| 153 | } |
| 154 | close(bundle_fd); |
| 155 | if (verify_bundle(the_repository, &header, |
| 156 | quiet ? VERIFY_BUNDLE_QUIET : VERIFY_BUNDLE_VERBOSE)) { |
| 157 | ret = 1; |
| 158 | goto cleanup; |
| 159 | } |
| 160 | |
| 161 | fprintf(stderr, _("%s is okay\n"), name); |
| 162 | ret = 0; |
| 163 | cleanup: |
| 164 | free(bundle_file); |
| 165 | bundle_header_release(&header); |
| 166 | return ret; |
| 167 | } |
| 168 | |
| 169 | static int cmd_bundle_list_heads(int argc, const char **argv, const char *prefix, |
| 170 | struct repository *repo UNUSED) { |
nothing calls this directly
no test coverage detected