| 1419 | } |
| 1420 | |
| 1421 | static int show(int argc, const char **argv, const char *prefix, |
| 1422 | struct repository *repo UNUSED) |
| 1423 | { |
| 1424 | int no_query = 0, result = 0, query_flag = 0; |
| 1425 | struct option options[] = { |
| 1426 | OPT_BOOL('n', NULL, &no_query, N_("do not query remotes")), |
| 1427 | OPT_END() |
| 1428 | }; |
| 1429 | struct show_info info = SHOW_INFO_INIT; |
| 1430 | |
| 1431 | argc = parse_options(argc, argv, prefix, options, |
| 1432 | builtin_remote_show_usage, |
| 1433 | 0); |
| 1434 | |
| 1435 | if (argc < 1) |
| 1436 | return show_all(); |
| 1437 | |
| 1438 | if (!no_query) |
| 1439 | query_flag = (GET_REF_STATES | GET_HEAD_NAMES | GET_PUSH_REF_STATES); |
| 1440 | |
| 1441 | for (; argc; argc--, argv++) { |
| 1442 | size_t i; |
| 1443 | struct strvec *url; |
| 1444 | |
| 1445 | get_remote_ref_states(*argv, &info.states, query_flag); |
| 1446 | |
| 1447 | printf_ln(_("* remote %s"), *argv); |
| 1448 | printf_ln(_(" Fetch URL: %s"), info.states.remote->url.v[0]); |
| 1449 | url = push_url_of_remote(info.states.remote); |
| 1450 | for (i = 0; i < url->nr; i++) |
| 1451 | /* |
| 1452 | * TRANSLATORS: the colon ':' should align |
| 1453 | * with the one in " Fetch URL: %s" |
| 1454 | * translation. |
| 1455 | */ |
| 1456 | printf_ln(_(" Push URL: %s"), url->v[i]); |
| 1457 | if (!i) |
| 1458 | printf_ln(_(" Push URL: %s"), _("(no URL)")); |
| 1459 | if (no_query) |
| 1460 | printf_ln(_(" HEAD branch: %s"), _("(not queried)")); |
| 1461 | else if (!info.states.heads.nr) |
| 1462 | printf_ln(_(" HEAD branch: %s"), _("(unknown)")); |
| 1463 | else if (info.states.heads.nr == 1) |
| 1464 | printf_ln(_(" HEAD branch: %s"), info.states.heads.items[0].string); |
| 1465 | else { |
| 1466 | printf(_(" HEAD branch (remote HEAD is ambiguous," |
| 1467 | " may be one of the following):\n")); |
| 1468 | for (i = 0; i < info.states.heads.nr; i++) |
| 1469 | printf(" %s\n", info.states.heads.items[i].string); |
| 1470 | } |
| 1471 | |
| 1472 | /* remote branch info */ |
| 1473 | info.width = 0; |
| 1474 | for_each_string_list(&info.states.new_refs, add_remote_to_show_info, &info); |
| 1475 | for_each_string_list(&info.states.skipped, add_remote_to_show_info, &info); |
| 1476 | for_each_string_list(&info.states.tracked, add_remote_to_show_info, &info); |
| 1477 | for_each_string_list(&info.states.stale, add_remote_to_show_info, &info); |
| 1478 | if (info.list.nr) |
nothing calls this directly
no test coverage detected