| 682 | } |
| 683 | |
| 684 | static void handle_commit(struct commit *commit, struct rev_info *rev, |
| 685 | struct string_list *paths_of_changed_objects) |
| 686 | { |
| 687 | int saved_output_format = rev->diffopt.output_format; |
| 688 | const char *commit_buffer, *commit_buffer_cursor; |
| 689 | const char *author, *author_end, *committer, *committer_end; |
| 690 | const char *encoding = NULL; |
| 691 | size_t encoding_len; |
| 692 | struct string_list signatures = STRING_LIST_INIT_DUP; |
| 693 | const char *message; |
| 694 | char *reencoded = NULL; |
| 695 | struct commit_list *p; |
| 696 | const char *refname; |
| 697 | int i; |
| 698 | |
| 699 | rev->diffopt.output_format = DIFF_FORMAT_CALLBACK; |
| 700 | |
| 701 | parse_commit_or_die(commit); |
| 702 | commit_buffer_cursor = commit_buffer = repo_get_commit_buffer(the_repository, commit, NULL); |
| 703 | |
| 704 | author = strstr(commit_buffer_cursor, "\nauthor "); |
| 705 | if (!author) |
| 706 | die(_("could not find author in commit %s"), |
| 707 | oid_to_hex(&commit->object.oid)); |
| 708 | author++; |
| 709 | commit_buffer_cursor = author_end = strchrnul(author, '\n'); |
| 710 | |
| 711 | committer = strstr(commit_buffer_cursor, "\ncommitter "); |
| 712 | if (!committer) |
| 713 | die(_("could not find committer in commit %s"), |
| 714 | oid_to_hex(&commit->object.oid)); |
| 715 | committer++; |
| 716 | commit_buffer_cursor = committer_end = strchrnul(committer, '\n'); |
| 717 | |
| 718 | /* |
| 719 | * find_commit_header() and find_commit_multiline_header() get |
| 720 | * a `+ 1` because commit_buffer_cursor points at the trailing |
| 721 | * "\n" at the end of the previous line, but they want a |
| 722 | * pointer to the beginning of the next line. |
| 723 | */ |
| 724 | |
| 725 | if (*commit_buffer_cursor == '\n') { |
| 726 | encoding = find_commit_header(commit_buffer_cursor + 1, "encoding", &encoding_len); |
| 727 | if (encoding) |
| 728 | commit_buffer_cursor = encoding + encoding_len; |
| 729 | } |
| 730 | |
| 731 | if (*commit_buffer_cursor == '\n') { |
| 732 | const char *after_sha1 = append_signatures_for_header(&signatures, commit_buffer_cursor, |
| 733 | "gpgsig", "sha1"); |
| 734 | const char *after_sha256 = append_signatures_for_header(&signatures, commit_buffer_cursor, |
| 735 | "gpgsig-sha256", "sha256"); |
| 736 | commit_buffer_cursor = (after_sha1 > after_sha256) ? after_sha1 : after_sha256; |
| 737 | } |
| 738 | |
| 739 | message = strstr(commit_buffer_cursor, "\n\n"); |
| 740 | if (message) |
| 741 | message += 2; |
no test coverage detected