| 1428 | } |
| 1429 | |
| 1430 | static void show_rebase_information(struct wt_status *s, |
| 1431 | const char *color) |
| 1432 | { |
| 1433 | if (s->state.rebase_interactive_in_progress) { |
| 1434 | int i; |
| 1435 | int nr_lines_to_show = 2; |
| 1436 | |
| 1437 | struct string_list have_done = STRING_LIST_INIT_DUP; |
| 1438 | struct string_list yet_to_do = STRING_LIST_INIT_DUP; |
| 1439 | |
| 1440 | read_rebase_todolist(s->repo, "rebase-merge/done", &have_done); |
| 1441 | if (read_rebase_todolist(s->repo, "rebase-merge/git-rebase-todo", |
| 1442 | &yet_to_do)) |
| 1443 | status_printf_ln(s, color, |
| 1444 | _("git-rebase-todo is missing.")); |
| 1445 | if (have_done.nr == 0) |
| 1446 | status_printf_ln(s, color, _("No commands done.")); |
| 1447 | else { |
| 1448 | status_printf_ln(s, color, |
| 1449 | Q_("Last command done (%"PRIuMAX" command done):", |
| 1450 | "Last commands done (%"PRIuMAX" commands done):", |
| 1451 | have_done.nr), |
| 1452 | (uintmax_t)have_done.nr); |
| 1453 | for (i = (have_done.nr > nr_lines_to_show) |
| 1454 | ? have_done.nr - nr_lines_to_show : 0; |
| 1455 | i < have_done.nr; |
| 1456 | i++) |
| 1457 | status_printf_ln(s, color, " %s", have_done.items[i].string); |
| 1458 | if (have_done.nr > nr_lines_to_show && s->hints) { |
| 1459 | char *path = repo_git_path(s->repo, "rebase-merge/done"); |
| 1460 | status_printf_ln(s, color, |
| 1461 | _(" (see more in file %s)"), path); |
| 1462 | free(path); |
| 1463 | } |
| 1464 | } |
| 1465 | |
| 1466 | if (yet_to_do.nr == 0) |
| 1467 | status_printf_ln(s, color, |
| 1468 | _("No commands remaining.")); |
| 1469 | else { |
| 1470 | status_printf_ln(s, color, |
| 1471 | Q_("Next command to do (%"PRIuMAX" remaining command):", |
| 1472 | "Next commands to do (%"PRIuMAX" remaining commands):", |
| 1473 | yet_to_do.nr), |
| 1474 | (uintmax_t)yet_to_do.nr); |
| 1475 | for (i = 0; i < nr_lines_to_show && i < yet_to_do.nr; i++) |
| 1476 | status_printf_ln(s, color, " %s", yet_to_do.items[i].string); |
| 1477 | if (s->hints) |
| 1478 | status_printf_ln(s, color, |
| 1479 | _(" (use \"git rebase --edit-todo\" to view and edit)")); |
| 1480 | } |
| 1481 | string_list_clear(&yet_to_do, 0); |
| 1482 | string_list_clear(&have_done, 0); |
| 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | static void print_rebase_state(struct wt_status *s, |
| 1487 | const char *color) |
no test coverage detected