From: Junio C Hamano Date: Mon, 5 Jun 2017 00:03:10 +0000 (+0900) Subject: Merge branch 'ab/c-translators-comment-style' into maint X-Git-Tag: v2.13.1~20 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b19174e2f37cc696cbfded9a02c2f2fd6e93bce7?ds=inline;hp=-c Merge branch 'ab/c-translators-comment-style' into maint Update the C style recommendation for notes for translators, as recent versions of gettext tools can work with our style of multi-line comments. * ab/c-translators-comment-style: C style: use standard style for "TRANSLATORS" comments --- b19174e2f37cc696cbfded9a02c2f2fd6e93bce7 diff --combined Documentation/CodingGuidelines index 2248cf7324,9fd7383819..c4cb5ff0d4 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@@ -24,7 -24,7 +24,7 @@@ code. For Git in general, a few rough "Once it _is_ in the tree, it's not really worth the patch noise to go and fix it up." - Cf. http://article.gmane.org/gmane.linux.kernel/943020 + Cf. http://lkml.iu.edu/hypermail/linux/kernel/1001.3/01069.html Make your code readable and sensible, and don't try to be clever. @@@ -256,12 -256,12 +256,12 @@@ For C programs Note however that a comment that explains a translatable string to translators uses a convention of starting with a magic token - "TRANSLATORS: " immediately after the opening delimiter, even when - it spans multiple lines. We do not add an asterisk at the beginning - of each line, either. E.g. + "TRANSLATORS: ", e.g. - /* TRANSLATORS: here is a comment that explains the string - to be translated, that follows immediately after it */ + /* + * TRANSLATORS: here is a comment that explains the string to + * be translated, that follows immediately after it. + */ _("Here is a translatable string explained by the above."); - Double negation is often harder to understand than no negation diff --combined bisect.c index fa477a3e24,c5d5a2b64b..aaab6ada2b --- a/bisect.c +++ b/bisect.c @@@ -546,7 -546,7 +546,7 @@@ static unsigned get_prn(unsigned count /* * Custom integer square root from - * http://en.wikipedia.org/wiki/Integer_square_root + * https://en.wikipedia.org/wiki/Integer_square_root */ static int sqrti(int val) { @@@ -995,8 -995,10 +995,10 @@@ int bisect_next_all(const char *prefix steps_msg = xstrfmt(Q_("(roughly %d step)", "(roughly %d steps)", steps), steps); - /* TRANSLATORS: the last %s will be replaced with - "(roughly %d steps)" translation */ + /* + * TRANSLATORS: the last %s will be replaced with "(roughly %d + * steps)" translation. + */ printf(Q_("Bisecting: %d revision left to test after this %s\n", "Bisecting: %d revisions left to test after this %s\n", nr), nr, steps_msg); diff --combined sequencer.c index 4dcf9c8be0,b77f359ca2..8c72cf1614 --- a/sequencer.c +++ b/sequencer.c @@@ -464,7 -464,8 +464,8 @@@ static int do_recursive_merge(struct co if (active_cache_changed && write_locked_index(&the_index, &index_lock, COMMIT_LOCK)) - /* TRANSLATORS: %s will be "revert", "cherry-pick" or + /* + * TRANSLATORS: %s will be "revert", "cherry-pick" or * "rebase -i". */ return error(_("%s: Unable to write new index file"), @@@ -1045,7 -1046,6 +1046,7 @@@ static int do_pick_commit(enum todo_com strbuf_addstr(&msgbuf, p); if (opts->record_origin) { + strbuf_complete_line(&msgbuf); if (!has_conforming_footer(&msgbuf, NULL, 0)) strbuf_addch(&msgbuf, '\n'); strbuf_addstr(&msgbuf, cherry_picked_prefix); @@@ -1914,13 -1914,11 +1915,13 @@@ static int apply_autostash(struct repla strbuf_trim(&stash_sha1); child.git_cmd = 1; + child.no_stdout = 1; + child.no_stderr = 1; argv_array_push(&child.args, "stash"); argv_array_push(&child.args, "apply"); argv_array_push(&child.args, stash_sha1.buf); if (!run_command(&child)) - printf(_("Applied autostash.")); + printf(_("Applied autostash.\n")); else { struct child_process store = CHILD_PROCESS_INIT; @@@ -2091,7 -2089,6 +2092,7 @@@ cleanup_head_ref res = error(_("could not read orig-head")); goto cleanup_head_ref; } + strbuf_reset(&buf); if (!read_oneliner(&buf, rebase_path_onto(), 0)) { res = error(_("could not read 'onto'")); goto cleanup_head_ref; @@@ -2361,9 -2358,6 +2362,9 @@@ void append_signoff(struct strbuf *msgb getenv("GIT_COMMITTER_EMAIL"))); strbuf_addch(&sob, '\n'); + if (!ignore_footer) + strbuf_complete_line(msgbuf); + /* * If the whole message buffer is equal to the sob, pretend that we * found a conforming footer with a matching sob @@@ -2384,6 -2378,13 +2385,6 @@@ * the title and body to be filled in by the user. */ append_newlines = "\n\n"; - } else if (msgbuf->buf[len - 1] != '\n') { - /* - * Incomplete line. Complete the line and add a - * blank one so that there is an empty line between - * the message body and the sob. - */ - append_newlines = "\n\n"; } else if (len == 1) { /* * Buffer contains a single newline. Add another