Git fork

sequencer: use const variable for commit message comments

This makes it easier to use and reuse the comments.

Mentored-by: Christian Couder <chriscool@tuxfamily.org>
Mentored-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Reviewed-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Charvi Mendiratta <charvi077@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Charvi Mendiratta and committed by
Junio C Hamano
71ee81cd ae70e34f

+10 -5
+10 -5
sequencer.c
··· 1732 1732 return p - body; 1733 1733 } 1734 1734 1735 + static const char first_commit_msg_str[] = N_("This is the 1st commit message:"); 1736 + static const char nth_commit_msg_fmt[] = N_("This is the commit message #%d:"); 1737 + static const char skip_nth_commit_msg_fmt[] = N_("The commit message #%d will be skipped:"); 1738 + static const char combined_commit_msg_fmt[] = N_("This is a combination of %d commits."); 1739 + 1735 1740 static void append_squash_message(struct strbuf *buf, const char *body, 1736 1741 struct replay_opts *opts) 1737 1742 { ··· 1741 1746 if (starts_with(body, "squash!") || starts_with(body, "fixup!")) 1742 1747 commented_len = subject_length(body); 1743 1748 strbuf_addf(buf, "\n%c ", comment_line_char); 1744 - strbuf_addf(buf, _("This is the commit message #%d:"), 1749 + strbuf_addf(buf, _(nth_commit_msg_fmt), 1745 1750 ++opts->current_fixup_count + 1); 1746 1751 strbuf_addstr(buf, "\n\n"); 1747 1752 strbuf_add_commented_lines(buf, body, commented_len); ··· 1770 1775 buf.buf : strchrnul(buf.buf, '\n'); 1771 1776 1772 1777 strbuf_addf(&header, "%c ", comment_line_char); 1773 - strbuf_addf(&header, _("This is a combination of %d commits."), 1778 + strbuf_addf(&header, _(combined_commit_msg_fmt), 1774 1779 opts->current_fixup_count + 2); 1775 1780 strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len); 1776 1781 strbuf_release(&header); ··· 1794 1799 } 1795 1800 1796 1801 strbuf_addf(&buf, "%c ", comment_line_char); 1797 - strbuf_addf(&buf, _("This is a combination of %d commits."), 2); 1802 + strbuf_addf(&buf, _(combined_commit_msg_fmt), 2); 1798 1803 strbuf_addf(&buf, "\n%c ", comment_line_char); 1799 - strbuf_addstr(&buf, _("This is the 1st commit message:")); 1804 + strbuf_addstr(&buf, _(first_commit_msg_str)); 1800 1805 strbuf_addstr(&buf, "\n\n"); 1801 1806 strbuf_addstr(&buf, body); 1802 1807 ··· 1812 1817 append_squash_message(&buf, body, opts); 1813 1818 } else if (command == TODO_FIXUP) { 1814 1819 strbuf_addf(&buf, "\n%c ", comment_line_char); 1815 - strbuf_addf(&buf, _("The commit message #%d will be skipped:"), 1820 + strbuf_addf(&buf, _(skip_nth_commit_msg_fmt), 1816 1821 ++opts->current_fixup_count + 1); 1817 1822 strbuf_addstr(&buf, "\n\n"); 1818 1823 strbuf_add_commented_lines(&buf, body, strlen(body));