git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alban Gruin <alban.gruin@gmail.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>,
	Christian Couder <christian.couder@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	phillip.wood@dunelm.org.uk, Alban Gruin <alban.gruin@gmail.com>
Subject: [GSoC][PATCH 2/2] sequencer: remove newlines from append_todo_help() messages
Date: Thu, 31 May 2018 13:01:30 +0200	[thread overview]
Message-ID: <20180531110130.18839-3-alban.gruin@gmail.com> (raw)
In-Reply-To: <20180531110130.18839-1-alban.gruin@gmail.com>

This removes newlines before and after the messages in
append_todo_help(). This is done to avoid confusions from
translators.

These newlines are now inserted with
`strbuf_add_commented_lines()`. Messages were ended by two newlines
characters, but here we only insert one at a time. This is because
`strbuf_add_commented_lines()` automatically inserts a newline at the
end of the input, and ignore the last from the input.

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
 sequencer.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/sequencer.c b/sequencer.c
index 9b291845e..9ab6c28d7 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4228,7 +4228,7 @@ int append_todo_help(unsigned edit_todo, unsigned keep_empty)
 	struct strbuf buf = STRBUF_INIT;
 	FILE *todo;
 	int ret;
-	const char *msg = _("\nCommands:\n"
+	const char *msg = _("Commands:\n"
 "p, pick <commit> = use commit\n"
 "r, reword <commit> = use commit, but edit the commit message\n"
 "e, edit <commit> = use commit, but stop for amending\n"
@@ -4243,33 +4243,37 @@ int append_todo_help(unsigned edit_todo, unsigned keep_empty)
 ".       message (or the oneline, if no original merge commit was\n"
 ".       specified). Use -c <commit> to reword the commit message.\n"
 "\n"
-"These lines can be re-ordered; they are executed from top to bottom.\n");
+"These lines can be re-ordered; they are executed from top to bottom.");
 
 	todo = fopen_or_warn(rebase_path_todo(), "a");
 	if (!todo)
 		return 1;
 
+	strbuf_add_commented_lines(&buf, "\n", 1);
 	strbuf_add_commented_lines(&buf, msg, strlen(msg));
 
 	if (get_missing_commit_check_level() == CHECK_ERROR)
-		msg = _("\nDo not remove any line. Use 'drop' "
-			 "explicitly to remove a commit.\n");
+		msg = _("Do not remove any line. Use 'drop' "
+			 "explicitly to remove a commit.");
 	else
-		msg = _("\nIf you remove a line here "
-			 "THAT COMMIT WILL BE LOST.\n");
+		msg = _("If you remove a line here "
+			 "THAT COMMIT WILL BE LOST.");
 
+	strbuf_add_commented_lines(&buf, "\n", 1);
 	strbuf_add_commented_lines(&buf, msg, strlen(msg));
 
 	if (edit_todo)
-		msg = _("\nYou are editing the todo file "
+		msg = _("You are editing the todo file "
 			"of an ongoing interactive rebase.\n"
 			"To continue rebase after editing, run:\n"
-			"    git rebase --continue\n\n");
+			"    git rebase --continue");
 	else
-		msg = _("\nHowever, if you remove everything, "
-			"the rebase will be aborted.\n\n");
+		msg = _("However, if you remove everything, "
+			"the rebase will be aborted.");
 
+	strbuf_add_commented_lines(&buf, "\n", 1);
 	strbuf_add_commented_lines(&buf, msg, strlen(msg));
+	strbuf_add_commented_lines(&buf, "\n", 1);
 
 	if (!keep_empty) {
 		msg = _("Note that empty commits are commented out");
-- 
2.16.4


  parent reply	other threads:[~2018-05-31 11:03 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 11:01 [GSoC][PATCH 0/2] rebase -i: rewrite append_todo_help() in C Alban Gruin
2018-05-31 11:01 ` [GSoC][PATCH 1/2] rebase--interactive: " Alban Gruin
2018-05-31 11:01 ` Alban Gruin [this message]
2018-05-31 17:48 ` [GSoC][PATCH 0/2] rebase -i: " Phillip Wood
2018-05-31 18:44   ` Stefan Beller
2018-05-31 19:33     ` Alban Gruin
2018-05-31 19:41       ` Stefan Beller
2018-06-01  9:44     ` Phillip Wood
2018-06-01 19:46       ` Stefan Beller
2018-05-31 19:25   ` Alban Gruin
2018-06-01  9:38     ` Phillip Wood
2018-06-05 12:53 ` [GSoC][PATCH v2 0/1] " Alban Gruin
2018-06-05 12:53   ` [GSoC][PATCH v2 1/1] rebase--interactive: " Alban Gruin
2018-06-07 10:30   ` [GSoC][PATCH v3 0/1] rebase -i: " Alban Gruin
2018-06-07 10:30     ` [GSoC][PATCH v3 1/1] rebase--interactive: " Alban Gruin
2018-06-26 16:16     ` [GSoC][PATCH v4 0/2] rebase -i: " Alban Gruin
2018-06-26 16:16       ` [GSoC][PATCH v4 1/2] sequencer: make two functions and an enum from sequencer.c public Alban Gruin
2018-06-26 21:41         ` Johannes Schindelin
2018-06-27 14:54           ` Alban Gruin
2018-06-26 16:16       ` [GSoC][PATCH v4 2/2] rebase--interactive: rewrite append_todo_help() in C Alban Gruin
2018-06-26 21:43         ` Johannes Schindelin
2018-06-26 21:37       ` [GSoC][PATCH v4 0/2] rebase -i: " Johannes Schindelin
2018-06-27 14:54         ` Alban Gruin
2018-06-28 10:04       ` [GSoC][PATCH v5 " Alban Gruin
2018-06-28 10:04         ` [GSoC][PATCH v5 1/2] sequencer: make two functions and an enum from sequencer.c public Alban Gruin
2018-06-28 10:04         ` [GSoC][PATCH v5 2/2] rebase--interactive: rewrite append_todo_help() in C Alban Gruin
2018-06-28 18:05         ` [GSoC][PATCH v5 0/2] rebase -i: " Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180531110130.18839-3-alban.gruin@gmail.com \
    --to=alban.gruin@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=christian.couder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).