| 1691 | "variable i18n.commitEncoding to the encoding your project uses.\n"); |
| 1692 | |
| 1693 | static void write_commit_tree(struct strbuf *buffer, const char *msg, size_t msg_len, |
| 1694 | const struct object_id *tree, |
| 1695 | const struct object_id *parents, size_t parents_len, |
| 1696 | const char *author, const char *committer, |
| 1697 | const struct commit_extra_header *extra) |
| 1698 | { |
| 1699 | int encoding_is_utf8; |
| 1700 | size_t i; |
| 1701 | |
| 1702 | /* Not having i18n.commitencoding is the same as having utf-8 */ |
| 1703 | encoding_is_utf8 = is_encoding_utf8(git_commit_encoding); |
| 1704 | |
| 1705 | strbuf_grow(buffer, 8192); /* should avoid reallocs for the headers */ |
| 1706 | strbuf_addf(buffer, "tree %s\n", oid_to_hex(tree)); |
| 1707 | |
| 1708 | /* |
| 1709 | * NOTE! This ordering means that the same exact tree merged with a |
| 1710 | * different order of parents will be a _different_ changeset even |
| 1711 | * if everything else stays the same. |
| 1712 | */ |
| 1713 | for (i = 0; i < parents_len; i++) |
| 1714 | strbuf_addf(buffer, "parent %s\n", oid_to_hex(&parents[i])); |
| 1715 | |
| 1716 | /* Person/date information */ |
| 1717 | if (!author) |
| 1718 | author = git_author_info(IDENT_STRICT); |
| 1719 | strbuf_addf(buffer, "author %s\n", author); |
| 1720 | if (!committer) |
| 1721 | committer = git_committer_info(IDENT_STRICT); |
| 1722 | strbuf_addf(buffer, "committer %s\n", committer); |
| 1723 | if (!encoding_is_utf8) |
| 1724 | strbuf_addf(buffer, "encoding %s\n", git_commit_encoding); |
| 1725 | |
| 1726 | while (extra) { |
| 1727 | add_extra_header(buffer, extra); |
| 1728 | extra = extra->next; |
| 1729 | } |
| 1730 | strbuf_addch(buffer, '\n'); |
| 1731 | |
| 1732 | /* And add the comment */ |
| 1733 | strbuf_add(buffer, msg, msg_len); |
| 1734 | } |
| 1735 | |
| 1736 | int commit_tree_extended(const char *msg, size_t msg_len, |
| 1737 | const struct object_id *tree, |
no test coverage detected