| 618 | } |
| 619 | |
| 620 | static void print_ref_status(char flag, const char *summary, |
| 621 | struct ref *to, struct ref *from, const char *msg, |
| 622 | struct ref_push_report *report, |
| 623 | int porcelain, int summary_width) |
| 624 | { |
| 625 | const char *to_name; |
| 626 | |
| 627 | if (report && report->ref_name) |
| 628 | to_name = report->ref_name; |
| 629 | else |
| 630 | to_name = to->name; |
| 631 | |
| 632 | if (porcelain) { |
| 633 | if (from) |
| 634 | fprintf(stdout, "%c\t%s:%s\t", flag, from->name, to_name); |
| 635 | else |
| 636 | fprintf(stdout, "%c\t:%s\t", flag, to_name); |
| 637 | if (msg) |
| 638 | fprintf(stdout, "%s (%s)\n", summary, msg); |
| 639 | else |
| 640 | fprintf(stdout, "%s\n", summary); |
| 641 | } else { |
| 642 | const char *red = "", *reset = ""; |
| 643 | if (push_had_errors(to)) { |
| 644 | red = transport_get_color(TRANSPORT_COLOR_REJECTED); |
| 645 | reset = transport_get_color(TRANSPORT_COLOR_RESET); |
| 646 | } |
| 647 | fprintf(stderr, " %s%c %-*s%s ", red, flag, summary_width, |
| 648 | summary, reset); |
| 649 | if (from) |
| 650 | fprintf(stderr, "%s -> %s", |
| 651 | prettify_refname(from->name), |
| 652 | prettify_refname(to_name)); |
| 653 | else |
| 654 | fputs(prettify_refname(to_name), stderr); |
| 655 | if (msg) { |
| 656 | fputs(" (", stderr); |
| 657 | fputs(msg, stderr); |
| 658 | fputc(')', stderr); |
| 659 | } |
| 660 | fputc('\n', stderr); |
| 661 | } |
| 662 | } |
| 663 | |
| 664 | static void print_ok_ref_status(struct ref *ref, |
| 665 | struct ref_push_report *report, |
no test coverage detected