| 165 | } |
| 166 | |
| 167 | static int cmd_show_ref__verify(const struct show_one_options *show_one_opts, |
| 168 | const char **refs) |
| 169 | { |
| 170 | if (!refs || !*refs) |
| 171 | die("--verify requires a reference"); |
| 172 | |
| 173 | while (*refs) { |
| 174 | struct object_id oid; |
| 175 | |
| 176 | if ((starts_with(*refs, "refs/") || refname_is_safe(*refs)) && |
| 177 | !refs_read_ref(get_main_ref_store(the_repository), *refs, &oid)) { |
| 178 | struct reference ref = { |
| 179 | .name = *refs, |
| 180 | .oid = &oid, |
| 181 | }; |
| 182 | |
| 183 | show_one(show_one_opts, &ref); |
| 184 | } else if (!show_one_opts->quiet) { |
| 185 | die("'%s' - not a valid ref", *refs); |
| 186 | } else { |
| 187 | return 1; |
| 188 | } |
| 189 | |
| 190 | refs++; |
| 191 | } |
| 192 | |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | struct patterns_options { |
| 197 | int show_head; |
no test coverage detected