| 739 | } |
| 740 | |
| 741 | void show_log(struct rev_info *opt) |
| 742 | { |
| 743 | struct strbuf msgbuf = STRBUF_INIT; |
| 744 | struct log_info *log = opt->loginfo; |
| 745 | struct commit *commit = log->commit, *parent = log->parent; |
| 746 | int abbrev_commit = opt->abbrev_commit ? opt->abbrev : the_hash_algo->hexsz; |
| 747 | struct pretty_print_context ctx = {0}; |
| 748 | |
| 749 | opt->loginfo = NULL; |
| 750 | if (!opt->verbose_header) { |
| 751 | graph_show_commit(opt->graph); |
| 752 | |
| 753 | if (!opt->graph) |
| 754 | put_revision_mark(opt, commit); |
| 755 | fputs(repo_find_unique_abbrev(the_repository, &commit->object.oid, abbrev_commit), |
| 756 | opt->diffopt.file); |
| 757 | if (opt->print_parents) |
| 758 | show_parents(commit, abbrev_commit, opt->diffopt.file); |
| 759 | if (opt->children.name) |
| 760 | show_children(opt, commit, abbrev_commit); |
| 761 | show_decorations(opt, commit); |
| 762 | if (opt->graph && !graph_is_commit_finished(opt->graph)) { |
| 763 | putc('\n', opt->diffopt.file); |
| 764 | graph_show_remainder(opt->graph); |
| 765 | } |
| 766 | putc(opt->diffopt.line_termination, opt->diffopt.file); |
| 767 | return; |
| 768 | } |
| 769 | |
| 770 | /* |
| 771 | * If use_terminator is set, we already handled any record termination |
| 772 | * at the end of the last record. |
| 773 | * Otherwise, add a diffopt.line_termination character before all |
| 774 | * entries but the first. (IOW, as a separator between entries) |
| 775 | */ |
| 776 | if (opt->shown_one && !opt->use_terminator) { |
| 777 | /* |
| 778 | * If entries are separated by a newline, the output |
| 779 | * should look human-readable. If the last entry ended |
| 780 | * with a newline, print the graph output before this |
| 781 | * newline. Otherwise it will end up as a completely blank |
| 782 | * line and will look like a gap in the graph. |
| 783 | * |
| 784 | * If the entry separator is not a newline, the output is |
| 785 | * primarily intended for programmatic consumption, and we |
| 786 | * never want the extra graph output before the entry |
| 787 | * separator. |
| 788 | */ |
| 789 | if (opt->diffopt.line_termination == '\n' && |
| 790 | !opt->missing_newline) |
| 791 | graph_show_padding(opt->graph); |
| 792 | putc(opt->diffopt.line_termination, opt->diffopt.file); |
| 793 | } |
| 794 | opt->shown_one = 1; |
| 795 | |
| 796 | /* |
| 797 | * If the history graph was requested, |
| 798 | * print the graph, up to this commit's line |
no test coverage detected