{"thread":{"id":"42425","subject":"[PATCH v2 00/22] i18n and test updates","startedAt":"2016-05-23T19:27:19Z","lastAt":"2016-05-30T11:03:42Z","messageCount":38,"participants":["Vasco Almeida","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":22},"messages":[{"id":"287275","messageId":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":null,"subject":"[PATCH v2 00/22] i18n and test updates","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:19Z","receivedAt":"2016-05-23T19:27:19Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Marks several messages for translation and updates tests to pass under\nGETTEXT_POISON. Some tests were updated to fit previous i18n marks, others\nwere updated to fit marks made by these patches. Patches that only touch\ntest file refer to marks done in commits previous to these ones.\n\nThis re-roll takes into consideration the comments for v1 at\nhttp://thread.gmane.org/gmane.comp.version-control.git/294946\n\nInterdiff of v1 to v2 is included below.\n\nVasco Almeida (22):\n  i18n: builtin/remote.c: fix mark for translation\n  i18n: advice: mark string about detached head for translation\n  i18n: advice: internationalize message for conflicts\n  i18n: transport: mark strings for translation\n  i18n: sequencer: mark entire sentences for translation\n  i18n: sequencer: mark string for translation\n  i18n: merge-octopus: mark messages for translation\n  merge-octupus: use die shell function from git-sh-setup.sh\n  i18n: rebase: fix marked string to use eval_gettext variant\n  i18n: rebase: mark placeholder for translation\n  i18n: bisect: simplify error message for i18n\n  t6030: update to use test_i18ncmp\n  i18n: git-sh-setup.sh: mark strings for translation\n  i18n: rebase-interactive: mark strings for translation\n  i18n: rebase-interactive: mark here-doc strings for translation\n  i18n: rebase-interactive: mark comments of squash for translation\n  i18n: setup: mark strings for translation\n  tests: use test_i18n* functions to suppress false positives\n  tests: unpack-trees: update to use test_i18n* functions\n  t9003: become resilient to GETTEXT_POISON\n  t4153: fix negated test_i18ngrep call\n  t5523: use test_i18ngrep for negation\n\n Makefile                             |   5 +-\n advice.c                             |  21 ++-\n builtin/pull.c                       |   2 +-\n builtin/remote.c                     |   6 +-\n git-bisect.sh                        |   5 +-\n git-merge-octopus.sh                 |  24 ++-\n git-rebase--interactive.sh           | 287 +++++++++++++++++++++--------------\n git-rebase.sh                        |   4 +-\n git-sh-i18n.sh                       |   4 +\n git-sh-setup.sh                      |  56 +++++--\n sequencer.c                          |  13 +-\n setup.c                              |  16 +-\n t/lib-rebase.sh                      |   1 +\n t/t0008-ignores.sh                   |   4 +-\n t/t1011-read-tree-sparse-checkout.sh |   2 +-\n t/t1300-repo-config.sh               |   8 +-\n t/t1307-config-blob.sh               |   2 +-\n t/t1308-config-set.sh                |   4 +-\n t/t1400-update-ref.sh                |   2 +-\n t/t1506-rev-parse-diagnosis.sh       |   2 +-\n t/t2010-checkout-ambiguous.sh        |   2 +-\n t/t2018-checkout-branch.sh           |   2 +-\n t/t3200-branch.sh                    |   6 +-\n t/t3201-branch-contains.sh           |   2 +-\n t/t3320-notes-merge-worktrees.sh     |   2 +-\n t/t3400-rebase.sh                    |   4 +-\n t/t3404-rebase-interactive.sh        |  18 +--\n t/t4153-am-resume-override-opts.sh   |   2 +-\n t/t4208-log-magic-pathspec.sh        |   4 +-\n t/t5505-remote.sh                    |   2 +-\n t/t5510-fetch.sh                     |   2 +-\n t/t5520-pull.sh                      |   2 +-\n t/t5523-push-upstream.sh             |  12 +-\n t/t5536-fetch-conflicts.sh           |   4 +-\n t/t6030-bisect-porcelain.sh          |   4 +-\n t/t6301-for-each-ref-errors.sh       |  10 +-\n t/t7063-status-untracked-cache.sh    |   2 +-\n t/t7102-reset.sh                     |   4 +-\n t/t7400-submodule-basic.sh           |   2 +-\n t/t7403-submodule-sync.sh            |   4 +-\n t/t7406-submodule-update.sh          |  10 +-\n t/t7508-status.sh                    |   4 +-\n t/t7607-merge-overwrite.sh           |   2 +-\n t/t9003-help-autocorrect.sh          |   4 +-\n transport.c                          |  20 +--\n 45 files changed, 352 insertions(+), 246 deletions(-)\n\n---- >8 ----\ndiff --git a/advice.c b/advice.c\nindex bc531fc..4612165 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -80,17 +80,17 @@ int git_default_advice_config(const char *var, const char *value)\n int error_resolve_conflict(const char *me)\n {\n \tif (!strcmp(me, \"cherry-pick\"))\n-\t\terror(_(\"cherry-pick is not possible because you have unmerged files.\"));\n+\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n \telse if (!strcmp(me, \"commit\"))\n-\t\terror(_(\"commit is not possible because you have unmerged files.\"));\n+\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n \telse if (!strcmp(me, \"merge\"))\n-\t\terror(_(\"merge is not possible because you have unmerged files.\"));\n+\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n \telse if (!strcmp(me, \"pull\"))\n-\t\terror(_(\"pull is not possible because you have unmerged files.\"));\n+\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n \telse if (!strcmp(me, \"revert\"))\n-\t\terror(_(\"revert is not possible because you have unmerged files.\"));\n+\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n \telse\n-\t\terror(_(\"%s is not possible because you have unmerged files.\"),\n+\t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n \t\t\tme);\n \n \tif (advice_resolve_conflict)\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex b04389b..8e58127 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -128,7 +128,7 @@ mark_action_done () {\n \tif test \"$last_count\" != \"$new_count\"\n \tthen\n \t\tlast_count=$new_count\n-\t\tprintf \"$(gettext Rebasing) (%d/%d)\\r\" $new_count $total\n+\t\teval_gettext \"Rebasing (\\$new_count/\\$total)\"; printf \"\\r\"\n \t\ttest -z \"$verbose\" || echo\n \tfi\n }\n@@ -200,15 +200,14 @@ exit_with_patch () {\n \tmake_patch $1\n \tgit rev-parse --verify HEAD > \"$amend\"\n \tgpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n-\t# TRANSLATORS: after this line is a command to be issued by the user\n-\twarn \"$(gettext \"You can amend the commit now, with\")\"\n-\twarn\n-\twarn \"\tgit commit --amend $gpg_sign_opt_quoted\"\n-\twarn\n-\t# TRANSLATORS: after this line is a command to be issued by the user\n-\twarn \"$(gettext \"Once you are satisfied with your changes, run\")\"\n-\twarn\n-\twarn \"\tgit rebase --continue\"\n+\twarn \"$(eval_gettext \"\\\n+You can amend the commit now, with\n+\n+\tgit commit --amend \\$gpg_sign_opt_quoted\n+\n+Once you are satisfied with your changes, run\n+\n+\tgit rebase --continue\")\"\n \twarn\n \texit $2\n }\n@@ -657,7 +656,7 @@ you are able to reword the commit.\")\"\n \tx|\"exec\")\n \t\tread -r command rest < \"$todo\"\n \t\tmark_action_done\n-\t\tprintf \"$(gettext Executing:) %s\\n\" \"$rest\"\n+\t\teval_gettextln \"Executing: \\$rest\"\n \t\t\"${SHELL:-@SHELL_PATH@}\" -c \"$rest\" # Actual execution\n \t\tstatus=$?\n \t\t# Run in subshell because require_clean_work_tree can die.\n@@ -665,14 +664,14 @@ you are able to reword the commit.\")\"\n \t\t(require_clean_work_tree \"rebase\" 2>/dev/null) || dirty=t\n \t\tif test \"$status\" -ne 0\n \t\tthen\n-\t\t\twarn \"$(gettext \"Execution failed:\") $rest\"\n+\t\t\twarn \"$(eval_gettext \"Execution failed: \\$rest\")\"\n \t\t\ttest \"$dirty\" = f ||\n \t\t\t\twarn \"$(gettext \"and made changes to the index and/or the working tree\")\"\n \n-\t\t\t# TRANSLATORS: after this line is a command to be issued by the user\n-\t\t\twarn \"$(gettext \"You can fix the problem, and then run\")\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+\t\t\twarn \"$(gettext \"\\\n+You can fix the problem, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\tif test $status -eq 127\t\t# command not found\n \t\t\tthen\n@@ -685,15 +684,15 @@ you are able to reword the commit.\")\"\n \t\t\twarn \"$(eval_gettext \"\\\n Execution succeeded: \\$rest\n but left changes to the index and/or the working tree\n-Commit or stash your changes, and then run\")\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+Commit or stash your changes, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\texit 1\n \t\tfi\n \t\t;;\n \t*)\n-\t\twarn \"$(gettext \"Unknown command:\") $command $sha1 $rest\"\n+\t\twarn \"$(eval_gettext \"Unknown command: \\$command \\$sha1 \\$rest\")\"\n \t\tfixtodo=\"$(gettext \"Please fix this using 'git rebase --edit-todo'.\")\"\n \t\tif git rev-parse --verify -q \"$sha1\" >/dev/null\n \t\tthen\ndiff --git a/setup.c b/setup.c\nindex c86bf5c..6d0e0c9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -157,8 +157,8 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\t\t\t\t int diagnose_misspelt_rev)\n {\n \tif (!diagnose_misspelt_rev)\n-\t\tdie(\"%s: no such path in the working tree.\\n\"\n-\t\t    \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\",\n+\t\tdie(_(\"%s: no such path in the working tree.\\n\"\n+\t\t      \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\"),\n \t\t    arg);\n \t/*\n \t * Saying \"'(icase)foo' does not exist in the index\" when the\n@@ -170,9 +170,9 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\tmaybe_die_on_misspelt_object_name(arg, prefix);\n \n \t/* ... or fall back the most general message. */\n-\tdie(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n \n }\n \n@@ -220,9 +220,9 @@ void verify_non_filename(const char *prefix, const char *arg)\n \t\treturn; /* flag */\n \tif (!check_filename(prefix, arg))\n \t\treturn;\n-\tdie(\"ambiguous argument '%s': both revision and filename\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': both revision and filename\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n }\n \n int get_common_dir(struct strbuf *sb, const char *gitdir)\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 86c2ff2..79a0251 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -106,7 +106,7 @@ test_expect_success 'incorrect revision id' '\n \ttest_must_fail git rev-parse foobar:file.txt 2>error &&\n \tgrep \"Invalid object name '\"'\"'foobar'\"'\"'.\" error &&\n \ttest_must_fail git rev-parse foobar 2> error &&\n-\tgrep \"unknown revision or path not in the working tree.\" error\n+\ttest_i18ngrep \"unknown revision or path not in the working tree.\" error\n '\n \n test_expect_success 'incorrect file in sha1:path' '\ndiff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh\nindex d8f23f4..001343e 100755\n--- a/t/t4208-log-magic-pathspec.sh\n+++ b/t/t4208-log-magic-pathspec.sh\n@@ -18,7 +18,7 @@ test_expect_success '\"git log :/\" should not be ambiguous' '\n test_expect_success '\"git log :/a\" should be ambiguous (applied both rev and worktree)' '\n \t: >a &&\n \ttest_must_fail git log :/a 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success '\"git log :/a -- \" should not be ambiguous' '\n@@ -31,7 +31,7 @@ test_expect_success '\"git log -- :/a\" should not be ambiguous' '\n \n test_expect_success '\"git log :\" should be ambiguous' '\n \ttest_must_fail git log : 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success 'git log -- :' '\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 61beff6..45e44ca 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest -n \"$(git ls-files -u)\" &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n-\ttest_i18ngrep \"pull is not possible because you have unmerged files\" err &&\n+\ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n \ttest -z \"$(git ls-files -u)\" &&\ndiff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\nindex f6f6c92..b1c7919 100755\n--- a/t/t9003-help-autocorrect.sh\n+++ b/t/t9003-help-autocorrect.sh\n@@ -31,14 +31,10 @@ test_expect_success 'autocorrect showing candidates' '\n \tgit config help.autocorrect 0 &&\n \n \ttest_must_fail git lfg 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual |\n-\tsed -e \"/GETTEXT POISON/d\" actual |\n-\tgrep lgf &&\n+\tgrep \"^\tlgf\" actual &&\n \n \ttest_must_fail git distimdist 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual |\n-\tsed -e \"/GETTEXT POISON/d\" actual |\n-\tgrep distimdistim\n+\tgrep \"^\tdistimdistim\" actual\n '\n \n test_expect_success 'autocorrect running commands' '\n---- >8 ----\n\n-- \n2.7.3\n"},{"id":"287276","messageId":"1464031661-18988-2-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 01/22] i18n: builtin/remote.c: fix mark for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:20Z","receivedAt":"2016-05-23T19:27:20Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The second string inside _() was not being extracted for translation by\nxgettext, meaning that, although the string was passed to gettext, there\nwas no translation available.\n\nMark each individual string instead of marking the result of ternary if.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/remote.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex d33766b..ae74da6 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -963,9 +963,9 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \n \tprintf(\"    %-*s \", show_info->width, item->string);\n \tif (branch_info->rebase) {\n-\t\tprintf_ln(_(branch_info->rebase == INTERACTIVE_REBASE ?\n-\t\t\t\"rebases interactively onto remote %s\" :\n-\t\t\t\"rebases onto remote %s\"), merge->items[0].string);\n+\t\tprintf_ln(branch_info->rebase == INTERACTIVE_REBASE\n+\t\t\t  ? _(\"rebases interactively onto remote %s\")\n+\t\t\t  : _(\"rebases onto remote %s\"), merge->items[0].string);\n \t\treturn 0;\n \t} else if (show_info->any_rebase) {\n \t\tprintf_ln(_(\" merges with remote %s\"), merge->items[0].string);\n-- \n2.7.3\n"},{"id":"287278","messageId":"1464031661-18988-3-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 02/22] i18n: advice: mark string about detached head for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:21Z","receivedAt":"2016-05-23T19:27:21Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark string with advice seen by the user when in detached head.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n advice.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex 4dc5cf1..703a847 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -107,13 +107,13 @@ void NORETURN die_conclude_merge(void)\n void detach_advice(const char *new_name)\n {\n \tconst char fmt[] =\n-\t\"Note: checking out '%s'.\\n\\n\"\n+\tN_(\"Note: checking out '%s'.\\n\\n\"\n \t\"You are in 'detached HEAD' state. You can look around, make experimental\\n\"\n \t\"changes and commit them, and you can discard any commits you make in this\\n\"\n \t\"state without impacting any branches by performing another checkout.\\n\\n\"\n \t\"If you want to create a new branch to retain commits you create, you may\\n\"\n \t\"do so (now or later) by using -b with the checkout command again. Example:\\n\\n\"\n-\t\"  git checkout -b <new-branch-name>\\n\\n\";\n+\t\"  git checkout -b <new-branch-name>\\n\\n\");\n \n \tfprintf(stderr, fmt, new_name);\n }\n-- \n2.7.3\n"},{"id":"287277","messageId":"1464031661-18988-4-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 03/22] i18n: advice: internationalize message for conflicts","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:22Z","receivedAt":"2016-05-23T19:27:22Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark message for translation telling the user she has conflicts to\nresolve. Expose each particular use case, in order to enable translating\nentire sentences which would facilitate translating into other\nlanguages.\n\nChange \"Pull\" to lowercase to match other instances. Update test\nt5520-pull.sh, that relied on the old error message, to use the new one.\n\nAlthough we loose in source code conciseness, we would gain better\ntranslations because translators can 1) translate the entire sentence,\nincluding those terms concerning Git (committing, merging, etc) 2) have\nleeway to adapt to their languages.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n\nIt is not clear to me what is the current stand on this approach, so I've\nupdated the commit message to include more information and changed the\nmessages a bit.\n\n advice.c        | 17 +++++++++++++++--\n builtin/pull.c  |  2 +-\n t/t5520-pull.sh |  2 +-\n 3 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex 703a847..4612165 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)\n \n int error_resolve_conflict(const char *me)\n {\n-\terror(\"%s is not possible because you have unmerged files.\", me);\n+\tif (!strcmp(me, \"cherry-pick\"))\n+\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"commit\"))\n+\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"merge\"))\n+\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"pull\"))\n+\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"revert\"))\n+\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n+\telse\n+\t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n+\t\t\tme);\n+\n \tif (advice_resolve_conflict)\n \t\t/*\n \t\t * Message used both when 'git commit' fails and when\n@@ -93,7 +106,7 @@ int error_resolve_conflict(const char *me)\n void NORETURN die_resolve_conflict(const char *me)\n {\n \terror_resolve_conflict(me);\n-\tdie(\"Exiting because of an unresolved conflict.\");\n+\tdie(_(\"Exiting because of an unresolved conflict.\"));\n }\n \n void NORETURN die_conclude_merge(void)\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 1d7333c..a980dcf 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -852,7 +852,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tgit_config(git_pull_config, NULL);\n \n \tif (read_cache_unmerged())\n-\t\tdie_resolve_conflict(\"Pull\");\n+\t\tdie_resolve_conflict(\"pull\");\n \n \tif (file_exists(git_path(\"MERGE_HEAD\")))\n \t\tdie_conclude_merge();\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 739c089..45e44ca 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest -n \"$(git ls-files -u)\" &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n-\ttest_i18ngrep \"Pull is not possible because you have unmerged files\" err &&\n+\ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n \ttest -z \"$(git ls-files -u)\" &&\n-- \n2.7.3\n"},{"id":"287280","messageId":"1464031661-18988-5-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 04/22] i18n: transport: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:23Z","receivedAt":"2016-05-23T19:27:23Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark one printf string and one error string for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n transport.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 095e61f..59b911e 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -59,7 +59,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,\n \t\t\t\tlocalname + 11, transport->remote->name,\n \t\t\t\tremotename);\n \t\telse\n-\t\t\tprintf(\"Would set upstream of '%s' to '%s' of '%s'\\n\",\n+\t\t\tprintf(_(\"Would set upstream of '%s' to '%s' of '%s'\\n\"),\n \t\t\t\tlocalname + 11, remotename + 11,\n \t\t\t\ttransport->remote->name);\n \t}\n@@ -148,7 +148,7 @@ static int set_git_option(struct git_transport_options *opts,\n \t\t\tchar *end;\n \t\t\topts->depth = strtol(value, &end, 0);\n \t\t\tif (*end)\n-\t\t\t\tdie(\"transport: invalid depth option '%s'\", value);\n+\t\t\t\tdie(_(\"transport: invalid depth option '%s'\"), value);\n \t\t}\n \t\treturn 0;\n \t}\n@@ -767,19 +767,19 @@ static void die_with_unpushed_submodules(struct string_list *needs_pushing)\n {\n \tint i;\n \n-\tfprintf(stderr, \"The following submodule paths contain changes that can\\n\"\n-\t\t\t\"not be found on any remote:\\n\");\n+\tfprintf(stderr, _(\"The following submodule paths contain changes that can\\n\"\n+\t\t\t\"not be found on any remote:\\n\"));\n \tfor (i = 0; i < needs_pushing->nr; i++)\n \t\tprintf(\"  %s\\n\", needs_pushing->items[i].string);\n-\tfprintf(stderr, \"\\nPlease try\\n\\n\"\n-\t\t\t\"\tgit push --recurse-submodules=on-demand\\n\\n\"\n-\t\t\t\"or cd to the path and use\\n\\n\"\n-\t\t\t\"\tgit push\\n\\n\"\n-\t\t\t\"to push them to a remote.\\n\\n\");\n+\tfprintf(stderr, _(\"\\nPlease try\\n\\n\"\n+\t\t\t  \"\tgit push --recurse-submodules=on-demand\\n\\n\"\n+\t\t\t  \"or cd to the path and use\\n\\n\"\n+\t\t\t  \"\tgit push\\n\\n\"\n+\t\t\t  \"to push them to a remote.\\n\\n\"));\n \n \tstring_list_clear(needs_pushing, 0);\n \n-\tdie(\"Aborting.\");\n+\tdie(_(\"Aborting.\"));\n }\n \n static int run_pre_push_hook(struct transport *transport,\n-- \n2.7.3\n"},{"id":"287279","messageId":"1464031661-18988-6-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 05/22] i18n: sequencer: mark entire sentences for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:24Z","receivedAt":"2016-05-23T19:27:24Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark entire sentences of error message rather than assembling one using\nplaceholders (e.g. \"Cannot %s during a %s\").\n\nThat would facilitate translation work because it is easier to translate\na entire sentence than translating pieces. We would have better\ntranslations at the expense of source code verbosity.\n\nMoreover, translators can now 1) translate the terms \"revert\" and\n\"cherry-pick\" if they please 2) have more leeway to adapt their\ntranslations.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n\nSimilarly to Patch 03/22, I've added more info to commit message, but haven't\ntouched the messages this time.\n\n sequencer.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 4687ad4..88a7c78 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -697,9 +697,14 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *\n \t * opts; we don't support arbitrary instructions\n \t */\n \tif (action != opts->action) {\n-\t\tconst char *action_str;\n-\t\taction_str = action == REPLAY_REVERT ? \"revert\" : \"cherry-pick\";\n-\t\terror(_(\"Cannot %s during a %s\"), action_str, action_name(opts));\n+\t\tif (action == REPLAY_REVERT)\n+\t\t      error((opts->action == REPLAY_REVERT)\n+\t\t\t    ? _(\"Cannot revert during a another revert.\")\n+\t\t\t    : _(\"Cannot revert during a cherry-pick.\"));\n+\t\telse\n+\t\t      error((opts->action == REPLAY_REVERT)\n+\t\t\t    ? _(\"Cannot cherry-pick during a revert.\")\n+\t\t\t    : _(\"Cannot cherry-pick during another cherry-pick.\"));\n \t\treturn NULL;\n \t}\n \n-- \n2.7.3\n"},{"id":"287281","messageId":"1464031661-18988-7-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 06/22] i18n: sequencer: mark string for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:25Z","receivedAt":"2016-05-23T19:27:25Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark informative string \"<action_name>: fast-forward\" for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 88a7c78..57b3671 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -225,7 +225,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,\n \tif (checkout_fast_forward(from, to, 1))\n \t\texit(128); /* the callee should have complained already */\n \n-\tstrbuf_addf(&sb, \"%s: fast-forward\", action_name(opts));\n+\tstrbuf_addf(&sb, _(\"%s: fast-forward\"), action_name(opts));\n \n \ttransaction = ref_transaction_begin(&err);\n \tif (!transaction ||\n-- \n2.7.3\n"},{"id":"287282","messageId":"1464031661-18988-8-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 07/22] i18n: merge-octopus: mark messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:26Z","receivedAt":"2016-05-23T19:27:26Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark messages in git-merge-octopus.sh for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-merge-octopus.sh | 18 ++++++++++--------\n 1 file changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/git-merge-octopus.sh b/git-merge-octopus.sh\nindex dc2fd1b..89e967a 100755\n--- a/git-merge-octopus.sh\n+++ b/git-merge-octopus.sh\n@@ -5,6 +5,8 @@\n # Resolve two or more trees.\n #\n \n+. git-sh-i18n\n+\n LF='\n '\n \n@@ -46,7 +48,7 @@ esac\n \n if ! git diff-index --quiet --cached HEAD --\n then\n-    echo \"Error: Your local changes to the following files would be overwritten by merge\"\n+    gettextln \"Error: Your local changes to the following files would be overwritten by merge\"\n     git diff-index --cached --name-only HEAD -- | sed -e 's/^/    /'\n     exit 2\n fi\n@@ -61,8 +63,8 @@ do\n \t\t# We allow only last one to have a hand-resolvable\n \t\t# conflicts.  Last round failed and we still had\n \t\t# a head to merge.\n-\t\techo \"Automated merge did not work.\"\n-\t\techo \"Should not be doing an Octopus.\"\n+\t\tgettextln \"Automated merge did not work.\"\n+\t\tgettextln \"Should not be doing an Octopus.\"\n \t\texit 2\n \tesac\n \n@@ -73,11 +75,11 @@ do\n \t\teval pretty_name=\\${GITHEAD_$SHA1_UP:-$pretty_name}\n \tfi\n \tcommon=$(git merge-base --all $SHA1 $MRC) ||\n-\t\tdie \"Unable to find common commit with $pretty_name\"\n+\t\tdie \"$(eval_gettext \"Unable to find common commit with \\$pretty_name\")\"\n \n \tcase \"$LF$common$LF\" in\n \t*\"$LF$SHA1$LF\"*)\n-\t\techo \"Already up-to-date with $pretty_name\"\n+\t\teval_gettextln \"Already up-to-date with \\$pretty_name\"\n \t\tcontinue\n \t\t;;\n \tesac\n@@ -89,7 +91,7 @@ do\n \t\t# tree as the intermediate result of the merge.\n \t\t# We still need to count this as part of the parent set.\n \n-\t\techo \"Fast-forwarding to: $pretty_name\"\n+\t\teval_gettextln \"Fast-forwarding to: \\$pretty_name\"\n \t\tgit read-tree -u -m $head $SHA1 || exit\n \t\tMRC=$SHA1 MRT=$(git write-tree)\n \t\tcontinue\n@@ -97,12 +99,12 @@ do\n \n \tNON_FF_MERGE=1\n \n-\techo \"Trying simple merge with $pretty_name\"\n+\teval_gettextln \"Trying simple merge with \\$pretty_name\"\n \tgit read-tree -u -m --aggressive  $common $MRT $SHA1 || exit 2\n \tnext=$(git write-tree 2>/dev/null)\n \tif test $? -ne 0\n \tthen\n-\t\techo \"Simple merge did not work, trying automatic merge.\"\n+\t\tgettextln \"Simple merge did not work, trying automatic merge.\"\n \t\tgit-merge-index -o git-merge-one-file -a ||\n \t\tOCTOPUS_FAILURE=1\n \t\tnext=$(git write-tree 2>/dev/null)\n-- \n2.7.3\n"},{"id":"287283","messageId":"1464031661-18988-9-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 08/22] merge-octupus: use die shell function from git-sh-setup.sh","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:27Z","receivedAt":"2016-05-23T19:27:27Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Source git-sh-setup in order to use die shell function from\ngit-sh-setup.sh library instead of using the one defined in\ngit-merge-octopus.sh. Remove the former die function.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-merge-octopus.sh | 6 +-----\n 1 file changed, 1 insertion(+), 5 deletions(-)\n\ndiff --git a/git-merge-octopus.sh b/git-merge-octopus.sh\nindex 89e967a..d79fc84 100755\n--- a/git-merge-octopus.sh\n+++ b/git-merge-octopus.sh\n@@ -5,16 +5,12 @@\n # Resolve two or more trees.\n #\n \n+. git-sh-setup\n . git-sh-i18n\n \n LF='\n '\n \n-die () {\n-    echo >&2 \"$*\"\n-    exit 1\n-}\n-\n # The first parameters up to -- are merge bases; the rest are heads.\n bases= head= remotes= sep_seen=\n for arg\n-- \n2.7.3\n"},{"id":"287296","messageId":"1464031661-18988-10-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 09/22] i18n: rebase: fix marked string to use eval_gettext variant","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:28Z","receivedAt":"2016-05-23T19:27:28Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The string message marked for translation should use eval_gettext\nvariant instead of the gettext one, since we want to dollar-substitute\n$head_name in the result.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 44ede36..1fadc04 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -154,7 +154,7 @@ move_to_original_branch () {\n \t\tgit symbolic-ref \\\n \t\t\t-m \"rebase finished: returning to $head_name\" \\\n \t\t\tHEAD $head_name ||\n-\t\tdie \"$(gettext \"Could not move back to $head_name\")\"\n+\t\tdie \"$(eval_gettext \"Could not move back to \\$head_name\")\"\n \t\t;;\n \tesac\n }\n-- \n2.7.3\n"},{"id":"287295","messageId":"1464031661-18988-11-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 10/22] i18n: rebase: mark placeholder for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:29Z","receivedAt":"2016-05-23T19:27:29Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark placeholder \"<branch>\" in git-rebase.sh for translation. The string\ncontaining the named placeholder is passed to shell function\nerror_on_missing_default_upstream in git-parse-remote.sh which uses it\nto display a command hint for the user.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 1fadc04..9ba21ab 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -449,7 +449,7 @@ then\n \t\tthen\n \t\t\t. git-parse-remote\n \t\t\terror_on_missing_default_upstream \"rebase\" \"rebase\" \\\n-\t\t\t\t\"against\" \"git rebase <branch>\"\n+\t\t\t\t\"against\" \"git rebase $(gettext '<branch>')\"\n \t\tfi\n \n \t\ttest \"$fork_point\" = auto && fork_point=t\n-- \n2.7.3\n"},{"id":"287293","messageId":"1464031661-18988-12-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 11/22] i18n: bisect: simplify error message for i18n","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:30Z","receivedAt":"2016-05-23T19:27:30Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The message was not being extracted by xgettext, although it was marked\nfor translation, seemingly because it contained a command substitution.\nMoreover, eval_gettext should be used instead of gettext for strings\nwith substitution.\n\nSee step 4. of section 15.5.2.1 Preparing Shell Scripts for\nInternationalization from gettext manual [1]:\n\"Simplify translatable strings so that they don't contain command\nsubstitution (\"`...`\" or \"$(...)\") [...]\"\n\n[1] http://www.gnu.org/software/gettext/manual/gettext.html#Preparing-Shell-Scripts\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-bisect.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 5d1cb00..737bf05 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -277,8 +277,9 @@ bisect_state() {\n \t0,*)\n \t\tdie \"$(gettext \"Please call 'bisect_state' with at least one argument.\")\" ;;\n \t1,\"$TERM_BAD\"|1,\"$TERM_GOOD\"|1,skip)\n-\t\trev=$(git rev-parse --verify $(bisect_head)) ||\n-\t\t\tdie \"$(gettext \"Bad rev input: $(bisect_head)\")\"\n+\t\tbisected_head=$(bisect_head)\n+\t\trev=$(git rev-parse --verify \"$bisected_head\") ||\n+\t\t\tdie \"$(eval_gettext \"Bad rev input: \\$bisected_head\")\"\n \t\tbisect_write \"$state\" \"$rev\"\n \t\tcheck_expected_revs \"$rev\" ;;\n \t2,\"$TERM_BAD\"|*,\"$TERM_GOOD\"|*,skip)\n-- \n2.7.3\n"},{"id":"287284","messageId":"1464031661-18988-13-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 12/22] t6030: update to use test_i18ncmp","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:31Z","receivedAt":"2016-05-23T19:27:31Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Since the git bisect output tested here is subject to translation, the\nhelper function test_i18ncmp should be used over test_cmp.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t6030-bisect-porcelain.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex e74662b..7012011 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -803,7 +803,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '\n \ttest_must_fail git bisect terms 1 2 &&\n \ttest_must_fail git bisect terms 2>actual &&\n \techo \"no terms defined\" >expected &&\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success 'bisect terms shows good/bad after start' '\n@@ -875,7 +875,7 @@ test_expect_success 'bisect start --term-* does store terms' '\n \tYour current terms are two for the old state\n \tand one for the new state.\n \tEOF\n-\ttest_cmp expected actual &&\n+\ttest_i18ncmp expected actual &&\n \tgit bisect terms --term-bad >actual &&\n \techo one >expected &&\n \ttest_cmp expected actual &&\n-- \n2.7.3\n"},{"id":"287297","messageId":"1464031661-18988-14-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 13/22] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:32Z","receivedAt":"2016-05-23T19:27:32Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Positional arguments, such as $0, $1, etc, need to be stored on shell\nvariables for use in translatable strings, according to gettext manual.\n\nAdd git-sh-setup.sh to LOCALIZED_SH variable in Makefile to enable\nextraction of string marked for translation by xgettext.\n\nAlthough git-sh-setup.sh is a shell library to be sourced by other shell\nscripts, it is necessary to source git-sh-i18n at this point, because\nsome scripts don't do it themselves. Not sourcing git-sh-i18n would lead\nto failure due to, for instance, gettextln not being found.\n\nSource \"$(git --exec-path)\"/git-sh-i18n instead of simply git-sh-i18n,\nbecause latter case would fail test t2300-cd-to-toplevel.sh.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n Makefile        |  4 +++-\n git-sh-setup.sh | 56 ++++++++++++++++++++++++++++++++++++++++++--------------\n 2 files changed, 45 insertions(+), 15 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex bc3d41e..d31fcf2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2062,7 +2062,9 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n \t--keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n-LOCALIZED_SH = $(SCRIPT_SH) git-parse-remote.sh\n+LOCALIZED_SH = $(SCRIPT_SH)\n+LOCALIZED_SH += git-parse-remote.sh\n+LOCALIZED_SH += git-sh-setup.sh\n LOCALIZED_PERL = $(SCRIPT_PERL)\n \n ifdef XGETTEXT_INCLUDE_TESTS\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex c48139a..55efa23 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -2,6 +2,10 @@\n # to set up some variables pointing at the normal git directories and\n # a few helper shell functions.\n \n+# Some shell scripts source git-sh-setup (i.e. this scriplet) but\n+# don't source git-sh-i18n which is needed here for gettext support.\n+. \"$(git --exec-path)\"/git-sh-i18n\n+\n # Having this variable in your environment would break scripts because\n # you would cause \"cd\" to be taken to unexpected places.  If you\n # like CDPATH, define it for your interactive shell sessions without\n@@ -83,14 +87,14 @@ if test -n \"$OPTIONS_SPEC\"; then\n else\n \tdashless=$(basename -- \"$0\" | sed -e 's/-/ /')\n \tusage() {\n-\t\tdie \"usage: $dashless $USAGE\"\n+\t\tdie \"$(gettext usage:) $dashless $USAGE\"\n \t}\n \n \tif [ -z \"$LONG_USAGE\" ]\n \tthen\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\"\n+\t\tLONG_USAGE=\"$(gettext usage:) $dashless $USAGE\"\n \telse\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\n+\t\tLONG_USAGE=\"$(gettext usage:) $dashless $USAGE\n \n $LONG_USAGE\"\n \tfi\n@@ -182,48 +186,72 @@ is_bare_repository () {\n cd_to_toplevel () {\n \tcdup=$(git rev-parse --show-toplevel) &&\n \tcd \"$cdup\" || {\n-\t\techo >&2 \"Cannot chdir to $cdup, the toplevel of the working tree\"\n+\t\tgettextln \"Cannot chdir to \\$cdup, the toplevel of the working tree\" >&2\n \t\texit 1\n \t}\n }\n \n require_work_tree_exists () {\n+\tprogram_name=$0\n \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n \tthen\n-\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \tfi\n }\n \n require_work_tree () {\n+\tprogram_name=$0\n \ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true ||\n-\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n }\n \n require_clean_work_tree () {\n+\taction=$1\n+\thint=$2\n \tgit rev-parse --verify HEAD >/dev/null || exit 1\n \tgit update-index -q --ignore-submodules --refresh\n \terr=0\n \n \tif ! git diff-files --quiet --ignore-submodules\n \tthen\n-\t\techo >&2 \"Cannot $1: You have unstaged changes.\"\n+\t\tcase \"$action\" in\n+\t\trebase)\n+\t\t\tgettextln \"Cannot rebase: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\t\"pull with rebase\")\n+\t\t\tgettextln \"Cannot pull with rebase: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\t*)\n+\t\t\teval_gettextln \"Cannot \\$action: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\tesac\n \t\terr=1\n \tfi\n \n \tif ! git diff-index --cached --quiet --ignore-submodules HEAD --\n \tthen\n-\t\tif [ $err = 0 ]\n+\t\tif test $err = 0\n \t\tthen\n-\t\t    echo >&2 \"Cannot $1: Your index contains uncommitted changes.\"\n+\t\t\tcase \"$action\" in\n+\t\t\trebase)\n+\t\t\t\tgettextln \"Cannot rebase: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\t\"pull with rebase\")\n+\t\t\t\tgettextln \"Cannot pull with rebase: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\t*)\n+\t\t\t\teval_gettextln \"Cannot \\$action: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\tesac\n \t\telse\n-\t\t    echo >&2 \"Additionally, your index contains uncommitted changes.\"\n+\t\t    gettextln \"Additionally, your index contains uncommitted changes.\" >&2\n \t\tfi\n \t\terr=1\n \tfi\n \n-\tif [ $err = 1 ]\n+\tif test $err = 1\n \tthen\n-\t\ttest -n \"$2\" && echo >&2 \"$2\"\n+\t\ttest -n \"$hint\" && echo \"$2\" >&2\n \t\texit 1\n \tfi\n }\n@@ -336,12 +364,12 @@ git_dir_init () {\n \tthen\n \t\ttest -z \"$(git rev-parse --show-cdup)\" || {\n \t\t\texit=$?\n-\t\t\techo >&2 \"You need to run this command from the toplevel of the working tree.\"\n+\t\t\tgettextln \"You need to run this command from the toplevel of the working tree.\" >&2\n \t\t\texit $exit\n \t\t}\n \tfi\n \ttest -n \"$GIT_DIR\" && GIT_DIR=$(cd \"$GIT_DIR\" && pwd) || {\n-\t\techo >&2 \"Unable to determine absolute path of git directory\"\n+\t\tgettextln \"Unable to determine absolute path of git directory\" >&2\n \t\texit 1\n \t}\n \t: ${GIT_OBJECT_DIRECTORY=\"$(git rev-parse --git-path objects)\"}\n-- \n2.7.3\n"},{"id":"287291","messageId":"1464031661-18988-15-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 14/22] i18n: rebase-interactive: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:33Z","receivedAt":"2016-05-23T19:27:33Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark strings in git-rebase--interactive.sh for translation. There is no\nneed to source git-sh-i18n since git-rebase.sh already does so.\n\nAdd git-rebase--interactive.sh to LOCALIZED_SH in Makefile in order to\nenable extracting strings marked for translation by xgettext.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n Makefile                   |   1 +\n git-rebase--interactive.sh | 188 ++++++++++++++++++++++++---------------------\n 2 files changed, 100 insertions(+), 89 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d31fcf2..c22c6f2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2064,6 +2064,7 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n LOCALIZED_SH = $(SCRIPT_SH)\n LOCALIZED_SH += git-parse-remote.sh\n+LOCALIZED_SH += git-rebase--interactive.sh\n LOCALIZED_SH += git-sh-setup.sh\n LOCALIZED_PERL = $(SCRIPT_PERL)\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 1c6dfb6..f53eed2 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -128,7 +128,7 @@ mark_action_done () {\n \tif test \"$last_count\" != \"$new_count\"\n \tthen\n \t\tlast_count=$new_count\n-\t\tprintf \"Rebasing (%d/%d)\\r\" $new_count $total\n+\t\teval_gettext \"Rebasing (\\$new_count/\\$total)\"; printf \"\\r\"\n \t\ttest -z \"$verbose\" || echo\n \tfi\n }\n@@ -201,13 +201,14 @@ exit_with_patch () {\n \tmake_patch $1\n \tgit rev-parse --verify HEAD > \"$amend\"\n \tgpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n-\twarn \"You can amend the commit now, with\"\n-\twarn\n-\twarn \"\tgit commit --amend $gpg_sign_opt_quoted\"\n-\twarn\n-\twarn \"Once you are satisfied with your changes, run\"\n-\twarn\n-\twarn \"\tgit rebase --continue\"\n+\twarn \"$(eval_gettext \"\\\n+You can amend the commit now, with\n+\n+\tgit commit --amend \\$gpg_sign_opt_quoted\n+\n+Once you are satisfied with your changes, run\n+\n+\tgit rebase --continue\")\"\n \twarn\n \texit $2\n }\n@@ -222,9 +223,10 @@ has_action () {\n }\n \n is_empty_commit() {\n-\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n-\t\tdie \"$1: not a commit that can be picked\")\n-\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n+\tsha1=$1\n+\ttree=$(git rev-parse -q --verify \"$sha1\"^{tree} 2>/dev/null ||\n+\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\")\n+\tptree=$(git rev-parse -q --verify \"$sha1\"^^{tree} 2>/dev/null ||\n \t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n \ttest \"$tree\" = \"$ptree\"\n }\n@@ -261,7 +263,7 @@ pick_one () {\n \n \tcase \"$1\" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac\n \tcase \"$force_rebase\" in '') ;; ?*) ff= ;; esac\n-\toutput git rev-parse --verify $sha1 || die \"Invalid commit name: $sha1\"\n+\toutput git rev-parse --verify $sha1 || die \"$(eval_gettext \"Invalid commit name: \\$sha1\")\"\n \n \tif is_empty_commit \"$sha1\"\n \tthen\n@@ -303,7 +305,7 @@ pick_one_preserving_merges () {\n \t\t\t\tgit rev-parse HEAD > \"$rewritten\"/$current_commit\n \t\t\tdone <\"$state_dir\"/current-commit\n \t\t\trm \"$state_dir\"/current-commit ||\n-\t\t\tdie \"Cannot write current commit's replacement sha1\"\n+\t\t\t\tdie \"$(gettext \"Cannot write current commit's replacement sha1\")\"\n \t\tfi\n \tfi\n \n@@ -355,9 +357,9 @@ pick_one_preserving_merges () {\n \tdone\n \tcase $fast_forward in\n \tt)\n-\t\toutput warn \"Fast-forward to $sha1\"\n+\t\toutput warn \"$(eval_gettext \"Fast-forward to \\$sha1\")\"\n \t\toutput git reset --hard $sha1 ||\n-\t\t\tdie \"Cannot fast-forward to $sha1\"\n+\t\t\tdie \"$(eval_gettext \"Cannot fast-forward to \\$sha1\")\"\n \t\t;;\n \tf)\n \t\tfirst_parent=$(expr \"$new_parents\" : ' \\([^ ]*\\)')\n@@ -366,12 +368,12 @@ pick_one_preserving_merges () {\n \t\tthen\n \t\t\t# detach HEAD to current parent\n \t\t\toutput git checkout $first_parent 2> /dev/null ||\n-\t\t\t\tdie \"Cannot move HEAD to $first_parent\"\n+\t\t\t\tdie \"$(eval_gettext \"Cannot move HEAD to \\$first_parent\")\"\n \t\tfi\n \n \t\tcase \"$new_parents\" in\n \t\t' '*' '*)\n-\t\t\ttest \"a$1\" = a-n && die \"Refusing to squash a merge: $sha1\"\n+\t\t\ttest \"a$1\" = a-n && die \"$(eval_gettext \"Refusing to squash a merge: \\$sha1\")\"\n \n \t\t\t# redo merge\n \t\t\tauthor_script_content=$(get_author_ident_from_commit $sha1)\n@@ -385,7 +387,7 @@ pick_one_preserving_merges () {\n \t\t\t\t$merge_args $strategy_args -m \"$msg_content\" $new_parents'\n \t\t\tthen\n \t\t\t\tprintf \"%s\\n\" \"$msg_content\" > \"$GIT_DIR\"/MERGE_MSG\n-\t\t\t\tdie_with_patch $sha1 \"Error redoing merge $sha1\"\n+\t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Error redoing merge \\$sha1\")\"\n \t\t\tfi\n \t\t\techo \"$sha1 $(git rev-parse HEAD^0)\" >> \"$rewritten_list\"\n \t\t\t;;\n@@ -393,7 +395,7 @@ pick_one_preserving_merges () {\n \t\t\toutput eval git cherry-pick \\\n \t\t\t\t${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")} \\\n \t\t\t\t\"$strategy_args\" \"$@\" ||\n-\t\t\t\tdie_with_patch $sha1 \"Could not pick $sha1\"\n+\t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Could not pick \\$sha1\")\"\n \t\t\t;;\n \t\tesac\n \t\t;;\n@@ -460,12 +462,14 @@ peek_next_command () {\n # messages, effectively causing the combined commit to be used as the\n # new basis for any further squash/fixups.  Args: sha1 rest\n die_failed_squash() {\n+\tsha1=$1\n+\trest=$2\n \tmv \"$squash_msg\" \"$msg\" || exit\n \trm -f \"$fixup_msg\"\n \tcp \"$msg\" \"$GIT_DIR\"/MERGE_MSG || exit\n \twarn\n-\twarn \"Could not apply $1... $2\"\n-\tdie_with_patch $1 \"\"\n+\twarn \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n+\tdie_with_patch $sha1 \"\"\n }\n \n flush_rewritten_pending() {\n@@ -489,6 +493,8 @@ record_in_rewritten() {\n }\n \n do_pick () {\n+\tsha1=$1\n+\trest=$2\n \tif test \"$(git rev-parse HEAD)\" = \"$squash_onto\"\n \tthen\n \t\t# Set the correct commit message and author info on the\n@@ -500,15 +506,15 @@ do_pick () {\n \t\t# resolve before manually running git commit --amend then git\n \t\t# rebase --continue.\n \t\tgit commit --allow-empty --allow-empty-message --amend \\\n-\t\t\t   --no-post-rewrite -n -q -C $1 &&\n-\t\t\tpick_one -n $1 &&\n+\t\t\t   --no-post-rewrite -n -q -C $sha1 &&\n+\t\t\tpick_one -n $sha1 &&\n \t\t\tgit commit --allow-empty --allow-empty-message \\\n-\t\t\t\t   --amend --no-post-rewrite -n -q -C $1 \\\n+\t\t\t\t   --amend --no-post-rewrite -n -q -C $sha1 \\\n \t\t\t\t   ${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\tdie_with_patch $1 \"Could not apply $1... $2\"\n+\t\t\t\t   die_with_patch $sha1 \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n \telse\n-\t\tpick_one $1 ||\n-\t\t\tdie_with_patch $1 \"Could not apply $1... $2\"\n+\t\tpick_one $sha1 ||\n+\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n \tfi\n }\n \n@@ -536,10 +542,11 @@ do_next () {\n \t\tmark_action_done\n \t\tdo_pick $sha1 \"$rest\"\n \t\tgit commit --amend --no-post-rewrite ${gpg_sign_opt:+\"$gpg_sign_opt\"} || {\n-\t\t\twarn \"Could not amend commit after successfully picking $sha1... $rest\"\n-\t\t\twarn \"This is most likely due to an empty commit message, or the pre-commit hook\"\n-\t\t\twarn \"failed. If the pre-commit hook failed, you may need to resolve the issue before\"\n-\t\t\twarn \"you are able to reword the commit.\"\n+\t\t\twarn \"$(eval_gettext \"\\\n+Could not amend commit after successfully picking \\$sha1... \\$rest\n+This is most likely due to an empty commit message, or the pre-commit hook\n+failed. If the pre-commit hook failed, you may need to resolve the issue before\n+you are able to reword the commit.\")\"\n \t\t\texit_with_patch $sha1 1\n \t\t}\n \t\trecord_in_rewritten $sha1\n@@ -550,7 +557,7 @@ do_next () {\n \t\tmark_action_done\n \t\tdo_pick $sha1 \"$rest\"\n \t\tsha1_abbrev=$(git rev-parse --short $sha1)\n-\t\twarn \"Stopped at $sha1_abbrev... $rest\"\n+\t\twarn \"$(eval_gettext \"Stopped at \\$sha1_abbrev... \\$rest\")\"\n \t\texit_with_patch $sha1 0\n \t\t;;\n \tsquash|s|fixup|f)\n@@ -565,7 +572,7 @@ do_next () {\n \t\tcomment_for_reflog $squash_style\n \n \t\ttest -f \"$done\" && has_action \"$done\" ||\n-\t\t\tdie \"Cannot '$squash_style' without a previous commit\"\n+\t\t\tdie \"$(eval_gettext \"Cannot '\\$squash_style' without a previous commit\")\"\n \n \t\tmark_action_done\n \t\tupdate_squash_messages $squash_style $sha1\n@@ -607,7 +614,7 @@ do_next () {\n \tx|\"exec\")\n \t\tread -r command rest < \"$todo\"\n \t\tmark_action_done\n-\t\tprintf 'Executing: %s\\n' \"$rest\"\n+\t\teval_gettextln \"Executing: \\$rest\"\n \t\t\"${SHELL:-@SHELL_PATH@}\" -c \"$rest\" # Actual execution\n \t\tstatus=$?\n \t\t# Run in subshell because require_clean_work_tree can die.\n@@ -615,13 +622,14 @@ do_next () {\n \t\t(require_clean_work_tree \"rebase\" 2>/dev/null) || dirty=t\n \t\tif test \"$status\" -ne 0\n \t\tthen\n-\t\t\twarn \"Execution failed: $rest\"\n+\t\t\twarn \"$(eval_gettext \"Execution failed: \\$rest\")\"\n \t\t\ttest \"$dirty\" = f ||\n-\t\t\twarn \"and made changes to the index and/or the working tree\"\n+\t\t\t\twarn \"$(gettext \"and made changes to the index and/or the working tree\")\"\n \n-\t\t\twarn \"You can fix the problem, and then run\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+\t\t\twarn \"$(gettext \"\\\n+You can fix the problem, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\tif test $status -eq 127\t\t# command not found\n \t\t\tthen\n@@ -630,18 +638,20 @@ do_next () {\n \t\t\texit \"$status\"\n \t\telif test \"$dirty\" = t\n \t\tthen\n-\t\t\twarn \"Execution succeeded: $rest\"\n-\t\t\twarn \"but left changes to the index and/or the working tree\"\n-\t\t\twarn \"Commit or stash your changes, and then run\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+\t\t\t# TRANSLATORS: after these lines is a command to be issued by the user\n+\t\t\twarn \"$(eval_gettext \"\\\n+Execution succeeded: \\$rest\n+but left changes to the index and/or the working tree\n+Commit or stash your changes, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\texit 1\n \t\tfi\n \t\t;;\n \t*)\n-\t\twarn \"Unknown command: $command $sha1 $rest\"\n-\t\tfixtodo=\"Please fix this using 'git rebase --edit-todo'.\"\n+\t\twarn \"$(eval_gettext \"Unknown command: \\$command \\$sha1 \\$rest\")\"\n+\t\tfixtodo=\"$(gettext \"Please fix this using 'git rebase --edit-todo'.\")\"\n \t\tif git rev-parse --verify -q \"$sha1\" >/dev/null\n \t\tthen\n \t\t\tdie_with_patch $sha1 \"$fixtodo\"\n@@ -676,7 +686,7 @@ do_next () {\n \t\t\"$hook\" rebase < \"$rewritten_list\"\n \t\ttrue # we don't care if this hook failed\n \tfi &&\n-\twarn \"Successfully rebased and updated $head_name.\"\n+\t\twarn \"$(eval_gettext \"Successfully rebased and updated \\$head_name.\")\"\n \n \treturn 1 # not failure; just to break the do_rest loop\n }\n@@ -723,7 +733,7 @@ skip_unnecessary_picks () {\n \t\trecord_in_rewritten \"$onto\"\n \t\t;;\n \tesac ||\n-\tdie \"Could not skip unnecessary pick commands\"\n+\t\tdie \"$(gettext \"Could not skip unnecessary pick commands\")\"\n }\n \n transform_todo_ids () {\n@@ -881,9 +891,9 @@ check_commit_sha () {\n \tif test $badsha -ne 0\n \tthen\n \t\tline=\"$(sed -n -e \"${2}p\" \"$3\")\"\n-\t\twarn \"Warning: the SHA-1 is missing or isn't\" \\\n-\t\t\t\"a commit in the following line:\"\n-\t\twarn \" - $line\"\n+\t\twarn \"$(eval_gettext \"\\\n+Warning: the SHA-1 is missing or isn't a commit in the following line:\n+ - \\$line\")\"\n \t\twarn\n \tfi\n \n@@ -914,9 +924,9 @@ check_bad_cmd_and_sha () {\n \t\t\t;;\n \t\t*)\n \t\t\tline=\"$(sed -n -e \"${lineno}p\" \"$1\")\"\n-\t\t\twarn \"Warning: the command isn't recognized\" \\\n-\t\t\t\t\"in the following line:\"\n-\t\t\twarn \" - $line\"\n+\t\t\twarn \"$(eval_gettext \"\\\n+Warning: the command isn't recognized in the following line:\n+ - \\$line\")\"\n \t\t\twarn\n \t\t\tretval=1\n \t\t\t;;\n@@ -953,7 +963,7 @@ warn_lines () {\n # Switch to the branch in $into and notify it in the reflog\n checkout_onto () {\n \tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\"\n-\toutput git checkout $onto || die_abort \"could not detach HEAD\"\n+\toutput git checkout $onto || die_abort \"$(gettext \"could not detach HEAD\")\"\n \tgit update-ref ORIG_HEAD $orig_head\n }\n \n@@ -991,28 +1001,26 @@ check_todo_list () {\n \t\tthen\n \t\t\ttest \"$check_level\" = error && raise_error=t\n \n-\t\t\twarn \"Warning: some commits may have been dropped\" \\\n-\t\t\t\t\"accidentally.\"\n-\t\t\twarn \"Dropped commits (newer to older):\"\n+\t\t\twarn \"$(gettext \"\\\n+Warning: some commits may have been dropped accidentally.\n+Dropped commits (newer to older):\")\"\n \n \t\t\t# Make the list user-friendly and display\n \t\t\topt=\"--no-walk=sorted --format=oneline --abbrev-commit --stdin\"\n \t\t\tgit rev-list $opt <\"$todo\".miss | warn_lines\n \n-\t\t\twarn \"To avoid this message, use \\\"drop\\\" to\" \\\n-\t\t\t\t\"explicitly remove a commit.\"\n-\t\t\twarn\n-\t\t\twarn \"Use 'git config rebase.missingCommitsCheck' to change\" \\\n-\t\t\t\t\"the level of warnings.\"\n-\t\t\twarn \"The possible behaviours are: ignore, warn, error.\"\n+\t\t\twarn \"$(gettext \"\\\n+To avoid this message, use \\\"drop\\\" to explicitly remove a commit.\n+\n+Use 'git config rebase.missingCommitsCheck' to change the level of warnings.\n+The possible behaviours are: ignore, warn, error.\")\"\n \t\t\twarn\n \t\tfi\n \t\t;;\n \tignore)\n \t\t;;\n \t*)\n-\t\twarn \"Unrecognized setting $check_level for option\" \\\n-\t\t\t\"rebase.missingCommitsCheck. Ignoring.\"\n+\t\twarn \"$(eval_gettext \"Unrecognized setting \\$check_level for option rebase.missingCommitsCheck. Ignoring.\")\"\n \t\t;;\n \tesac\n \n@@ -1029,8 +1037,8 @@ check_todo_list () {\n \t\t# placed before the commit of the next action\n \t\tcheckout_onto\n \n-\t\twarn \"You can fix this with 'git rebase --edit-todo'.\"\n-\t\tdie \"Or you can abort the rebase with 'git rebase --abort'.\"\n+\t\twarn \"$(gettext \"You can fix this with 'git rebase --edit-todo'.\")\"\n+\t\tdie \"$(gettext \"Or you can abort the rebase with 'git rebase --abort'.\")\"\n \tfi\n }\n \n@@ -1054,41 +1062,43 @@ continue)\n \n \t\ttest ! -f \"$GIT_DIR\"/CHERRY_PICK_HEAD ||\n \t\trm \"$GIT_DIR\"/CHERRY_PICK_HEAD ||\n-\t\tdie \"Could not remove CHERRY_PICK_HEAD\"\n+\t\tdie \"$(gettext \"Could not remove CHERRY_PICK_HEAD\")\"\n \telse\n \t\tif ! test -f \"$author_script\"\n \t\tthen\n \t\t\tgpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n-\t\t\tdie \"You have staged changes in your working tree. If these changes are meant to be\n+\t\t\tdie \"$(eval_gettext \"\\\n+You have staged changes in your working tree.\n+If these changes are meant to be\n squashed into the previous commit, run:\n \n-  git commit --amend $gpg_sign_opt_quoted\n+  git commit --amend \\$gpg_sign_opt_quoted\n \n If they are meant to go into a new commit, run:\n \n-  git commit $gpg_sign_opt_quoted\n+  git commit \\$gpg_sign_opt_quoted\n \n In both case, once you're done, continue with:\n \n   git rebase --continue\n-\"\n+\")\"\n \t\tfi\n \t\t. \"$author_script\" ||\n-\t\t\tdie \"Error trying to find the author identity to amend commit\"\n+\t\t\tdie \"$(gettext \"Error trying to find the author identity to amend commit\")\"\n \t\tif test -f \"$amend\"\n \t\tthen\n \t\t\tcurrent_head=$(git rev-parse --verify HEAD)\n \t\t\ttest \"$current_head\" = $(cat \"$amend\") ||\n-\t\t\tdie \"\\\n-You have uncommitted changes in your working tree. Please, commit them\n-first and then run 'git rebase --continue' again.\"\n+\t\t\tdie \"$(gettext \"\\\n+You have uncommitted changes in your working tree. Please commit them\n+first and then run 'git rebase --continue' again.\")\"\n \t\t\tdo_with_author git commit --amend --no-verify -F \"$msg\" -e \\\n \t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\t\tdie \"Could not commit staged changes.\"\n+\t\t\t\tdie \"$(gettext \"Could not commit staged changes.\")\"\n \t\telse\n \t\t\tdo_with_author git commit --no-verify -F \"$msg\" -e \\\n \t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\t\tdie \"Could not commit staged changes.\"\n+\t\t\t\tdie \"$(gettext \"Could not commit staged changes.\")\"\n \t\tfi\n \tfi\n \n@@ -1121,7 +1131,7 @@ To continue rebase after editing, run:\n EOF\n \n \tgit_sequence_editor \"$todo\" ||\n-\t\tdie \"Could not execute editor\"\n+\t\tdie \"$(gettext \"Could not execute editor\")\"\n \texpand_todo_ids\n \n \texit\n@@ -1129,7 +1139,7 @@ EOF\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\n-\tdie \"You need to set your committer info first\"\n+\tdie \"$(gettext \"You need to set your committer info first\")\"\n \n comment_for_reflog start\n \n@@ -1137,15 +1147,15 @@ if test ! -z \"$switch_to\"\n then\n \tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $switch_to\"\n \toutput git checkout \"$switch_to\" -- ||\n-\tdie \"Could not checkout $switch_to\"\n+\t\tdie \"$(eval_gettext \"Could not checkout \\$switch_to\")\"\n \n \tcomment_for_reflog start\n fi\n \n-orig_head=$(git rev-parse --verify HEAD) || die \"No HEAD?\"\n-mkdir -p \"$state_dir\" || die \"Could not create temporary $state_dir\"\n+orig_head=$(git rev-parse --verify HEAD) || die \"$(gettext \"No HEAD?\")\"\n+mkdir -p \"$state_dir\" || die \"$(eval_gettext \"Could not create temporary \\$state_dir\")\"\n \n-: > \"$state_dir\"/interactive || die \"Could not mark as interactive\"\n+: > \"$state_dir\"/interactive || die \"$(gettext \"Could not mark as interactive\")\"\n write_basic_state\n if test t = \"$preserve_merges\"\n then\n@@ -1155,12 +1165,12 @@ then\n \t\tfor c in $(git merge-base --all $orig_head $upstream)\n \t\tdo\n \t\t\techo $onto > \"$rewritten\"/$c ||\n-\t\t\t\tdie \"Could not init rewritten commits\"\n+\t\t\t\tdie \"$(gettext \"Could not init rewritten commits\")\"\n \t\tdone\n \telse\n \t\tmkdir \"$rewritten\" &&\n \t\techo $onto > \"$rewritten\"/root ||\n-\t\t\tdie \"Could not init rewritten commits\"\n+\t\t\tdie \"$(gettext \"Could not init rewritten commits\")\"\n \tfi\n \t# No cherry-pick because our first pass is to determine\n \t# parents to rewrite and skipping dropped commits would\n@@ -1270,7 +1280,7 @@ EOF\n \n if test -z \"$keep_empty\"\n then\n-\tprintf '%s\\n' \"$comment_char Note that empty commits are commented out\" >>\"$todo\"\n+\tprintf '%s\\n' \"$comment_char $(gettext \"Note that empty commits are commented out\")\" >>\"$todo\"\n fi\n \n \n@@ -1280,7 +1290,7 @@ has_action \"$todo\" ||\n cp \"$todo\" \"$todo\".backup\n collapse_todo_ids\n git_sequence_editor \"$todo\" ||\n-\tdie_abort \"Could not execute editor\"\n+\tdie_abort \"$(gettext \"Could not execute editor\")\"\n \n has_action \"$todo\" ||\n \treturn 2\n-- \n2.7.3\n"},{"id":"287285","messageId":"1464031661-18988-16-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 15/22] i18n: rebase-interactive: mark here-doc strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:34Z","receivedAt":"2016-05-23T19:27:34Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Use pipe to send gettext output to git stripspace instead of the\noriginal method of using shell here-document, because command\nsubstitution '$(...)' would not take place inside the here-documents.\nThe exception is the case of the last here-document redirecting to cat,\nin which commands substitution works and, thus, is preserved in this\ncommit.\n\nt3404: adapt test to the strings newly marked for translation\nTest t3404-rebase-interactive.sh would fail under GETTEXT_POISON unless\nusing test_i18ngrep.\n\nAdd eval_ngettext dummy function to be called by tests when running\nunder GETTEXT_POISON. Otherwise, tests would fail under gettext poison\nbecause that function could not be found.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase--interactive.sh    | 30 +++++++++++++++---------------\n git-sh-i18n.sh                |  4 ++++\n t/t3404-rebase-interactive.sh | 14 +++++++-------\n 3 files changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex f53eed2..cb302b0 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -144,29 +144,28 @@ reschedule_last_action () {\n }\n \n append_todo_help () {\n-\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+\tgettext \"\n Commands:\n  p, pick = use commit\n  r, reword = use commit, but edit the commit message\n  e, edit = use commit, but stop for amending\n  s, squash = use commit, but meld into previous commit\n- f, fixup = like \"squash\", but discard this commit's log message\n+ f, fixup = like \\\"squash\\\", but discard this commit's log message\n  x, exec = run command (the rest of the line) using shell\n  d, drop = remove commit\n \n These lines can be re-ordered; they are executed from top to bottom.\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n-EOF\n \tif test $(get_missing_commit_check_level) = error\n \tthen\n-\t\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n+\t\tgettext \"\n Do not remove any line. Use 'drop' explicitly to remove a commit.\n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \telse\n-\t\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n+\t\tgettext \"\n If you remove a line here THAT COMMIT WILL BE LOST.\n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \tfi\n }\n \n@@ -1122,13 +1121,12 @@ edit-todo)\n \tmv -f \"$todo\".new \"$todo\"\n \tcollapse_todo_ids\n \tappend_todo_help\n-\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+\tgettext \"\n You are editing the todo file of an ongoing interactive rebase.\n To continue rebase after editing, run:\n     git rebase --continue\n \n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n \tgit_sequence_editor \"$todo\" ||\n \t\tdie \"$(gettext \"Could not execute editor\")\"\n@@ -1269,14 +1267,16 @@ todocount=${todocount##* }\n \n cat >>\"$todo\" <<EOF\n \n-$comment_char Rebase $shortrevisions onto $shortonto ($todocount command(s))\n+$comment_char $(eval_ngettext \\\n+\t\"Rebase \\$shortrevisions onto \\$shortonto (\\$todocount command)\" \\\n+\t\"Rebase \\$shortrevisions onto \\$shortonto (\\$todocount commands)\" \\\n+\t\"$todocount\")\n EOF\n append_todo_help\n-git stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+gettext \"\n However, if you remove everything, the rebase will be aborted.\n \n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n if test -z \"$keep_empty\"\n then\ndiff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\nindex e6c3116..c14c303 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -64,6 +64,10 @@ poison)\n \teval_gettext () {\n \t\tprintf \"%s\" \"# GETTEXT POISON #\"\n \t}\n+\n+\teval_ngettext () {\n+\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n+\t}\n \t;;\n *)\n \tgettext () {\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 66348f1..f4ccd10 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -540,7 +540,7 @@ test_expect_success 'clean error after failed \"exec\"' '\n \techo \"edited again\" > file7 &&\n \tgit add file7 &&\n \ttest_must_fail git rebase --continue 2>error &&\n-\tgrep \"You have staged changes in your working tree.\" error\n+\ttest_i18ngrep \"You have staged changes in your working tree.\" error\n '\n \n test_expect_success 'rebase a detached HEAD' '\n@@ -1060,7 +1060,7 @@ test_expect_success 'todo count' '\n \tEOF\n \ttest_set_editor \"$(pwd)/dump-raw.sh\" &&\n \tgit rebase -i HEAD~4 >actual &&\n-\tgrep \"^# Rebase ..* onto ..* ([0-9]\" actual\n+\ttest_i18ngrep \"^# Rebase ..* onto ..* ([0-9]\" actual\n '\n \n test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '\n@@ -1160,7 +1160,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '\n \tFAKE_LINES=\"1 2 3 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n \ttest D = $(git cat-file commit HEAD | sed -ne \\$p) &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n cat >expect <<EOF\n@@ -1181,7 +1181,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '\n \tset_fake_editor &&\n \tFAKE_LINES=\"1 2 3 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \ttest D = $(git cat-file commit HEAD | sed -ne \\$p)\n '\n \n@@ -1205,7 +1205,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tcp .git/rebase-merge/git-rebase-todo.backup \\\n \t\t.git/rebase-merge/git-rebase-todo &&\n \tFAKE_LINES=\"1 2 drop 3 4 drop 5\" \\\n@@ -1228,7 +1228,7 @@ test_expect_success 'static check of bad command' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 3 bad 4 5\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tFAKE_LINES=\"1 2 3 drop 4 5\" git rebase --edit-todo &&\n \tgit rebase --continue &&\n \ttest E = $(git cat-file commit HEAD | sed -ne \\$p) &&\n@@ -1263,7 +1263,7 @@ test_expect_success 'static check of bad SHA-1' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 edit fakesha 3 4 5 #\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tFAKE_LINES=\"1 2 4 5 6\" git rebase --edit-todo &&\n \tgit rebase --continue &&\n \ttest E = $(git cat-file commit HEAD | sed -ne \\$p)\n-- \n2.7.3\n"},{"id":"287289","messageId":"1464031661-18988-17-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 16/22] i18n: rebase-interactive: mark comments of squash for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:35Z","receivedAt":"2016-05-23T19:27:35Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark comment messages of squash/fixup file ($squash_msg) for\ntranslation.\n\nHelper functions this_nth_commit_message and skip_nth_commit_message\nreplace the previous method of making the comment messages (such as\n\"This is the 2nd commit message:\") aided by nth_string helper function.\nThis step was taken as a workaround to enabled translation of entire\nsentences. However, doesn't change any text seen in English by the user,\nexcept for string \"The first commit's message is:\" which was changed to\nmatch the style of other instances.\n\nThe test t3404-rebase-interactive.sh resorts to set_fake_editor which\ndidn't account for GETTEXT_POISON. Fix it by assuming success when we\nfind dummy gettext poison output where was supposed to find the first\ncomment line \"This is a combination of $count commits.\".\n\nFor that same message, use plural aware eval_ngettext instead of\neval_gettext, since other languages have more complex plural forms.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase--interactive.sh | 69 +++++++++++++++++++++++++++++++++++++---------\n t/lib-rebase.sh            |  1 +\n 2 files changed, 57 insertions(+), 13 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex cb302b0..8e58127 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -401,12 +401,52 @@ pick_one_preserving_merges () {\n \tesac\n }\n \n-nth_string () {\n-\tcase \"$1\" in\n-\t*1[0-9]|*[04-9]) echo \"$1\"th;;\n-\t*1) echo \"$1\"st;;\n-\t*2) echo \"$1\"nd;;\n-\t*3) echo \"$1\"rd;;\n+this_nth_commit_message () {\n+\tn=$1\n+\tcase \"$n\" in\n+\t1) gettext \"This is the 1st commit message:\";;\n+\t2) gettext \"This is the 2nd commit message:\";;\n+\t3) gettext \"This is the 3rd commit message:\";;\n+\t4) gettext \"This is the 4th commit message:\";;\n+\t5) gettext \"This is the 5th commit message:\";;\n+\t6) gettext \"This is the 6th commit message:\";;\n+\t7) gettext \"This is the 7th commit message:\";;\n+\t8) gettext \"This is the 8th commit message:\";;\n+\t9) gettext \"This is the 9th commit message:\";;\n+\t10) gettext \"This is the 10th commit message:\";;\n+\t# TRANSLATORS: if the language you are translating into\n+\t# doesn't allow you to compose a sentence in this fashion,\n+\t# consider translating as if this and the following few strings\n+\t# were \"This is the commit message ${n}:\"\n+\t*1[0-9]|*[04-9]) eval_gettext \"This is the \\${n}th commit message:\";;\n+\t*1) eval_gettext \"This is the \\${n}st commit message:\";;\n+\t*2) eval_gettext \"This is the \\${n}nd commit message:\";;\n+\t*3) eval_gettext \"This is the \\${n}rd commit message:\";;\n+\t*) eval_gettext \"This is the commit message \\${n}:\";;\n+\tesac\n+}\n+skip_nth_commit_message () {\n+\tn=$1\n+\tcase \"$n\" in\n+\t1) gettext \"The 1st commit message will be skipped:\";;\n+\t2) gettext \"The 2nd commit message will be skipped:\";;\n+\t3) gettext \"The 3rd commit message will be skipped:\";;\n+\t4) gettext \"The 4th commit message will be skipped:\";;\n+\t5) gettext \"The 5th commit message will be skipped:\";;\n+\t6) gettext \"The 6th commit message will be skipped:\";;\n+\t7) gettext \"The 7th commit message will be skipped:\";;\n+\t8) gettext \"The 8th commit message will be skipped:\";;\n+\t9) gettext \"The 9th commit message will be skipped:\";;\n+\t10) gettext \"The 10th commit message will be skipped:\";;\n+\t# TRANSLATORS: if the language you are translating into\n+\t# doesn't allow you to compose a sentence in this fashion,\n+\t# consider translating as if this and the following few strings\n+\t# were \"The commit message ${n} will be skipped:\"\n+\t*1[0-9]|*[04-9]) eval_gettext \"The \\${n}th commit message will be skipped:\";;\n+\t*1) eval_gettext \"The \\${n}st commit message will be skipped:\";;\n+\t*2) eval_gettext \"The \\${n}nd commit message will be skipped:\";;\n+\t*3) eval_gettext \"The \\${n}rd commit message will be skipped:\";;\n+\t*) eval_gettext \"The commit message \\${n} will be skipped:\";;\n \tesac\n }\n \n@@ -414,20 +454,23 @@ update_squash_messages () {\n \tif test -f \"$squash_msg\"; then\n \t\tmv \"$squash_msg\" \"$squash_msg\".bak || exit\n \t\tcount=$(($(sed -n \\\n-\t\t\t-e \"1s/^. This is a combination of \\(.*\\) commits\\./\\1/p\" \\\n+\t\t\t-e \"1s/^$comment_char.*\\([0-9][0-9]*\\).*/\\1/p\" \\\n \t\t\t-e \"q\" < \"$squash_msg\".bak)+1))\n \t\t{\n-\t\t\tprintf '%s\\n' \"$comment_char This is a combination of $count commits.\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(eval_ngettext \\\n+\t\t\t\t\"This is a combination of \\$count commit.\" \\\n+\t\t\t\t\"This is a combination of \\$count commits.\" \\\n+\t\t\t\t$count)\"\n \t\t\tsed -e 1d -e '2,/^./{\n \t\t\t\t/^$/d\n \t\t\t}' <\"$squash_msg\".bak\n \t\t} >\"$squash_msg\"\n \telse\n-\t\tcommit_message HEAD > \"$fixup_msg\" || die \"Cannot write $fixup_msg\"\n+\t\tcommit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n \t\tcount=2\n \t\t{\n-\t\t\tprintf '%s\\n' \"$comment_char This is a combination of 2 commits.\"\n-\t\t\tprintf '%s\\n' \"$comment_char The first commit's message is:\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is a combination of 2 commits.\")\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is the 1st commit message:\")\"\n \t\t\techo\n \t\t\tcat \"$fixup_msg\"\n \t\t} >\"$squash_msg\"\n@@ -436,13 +479,13 @@ update_squash_messages () {\n \tsquash)\n \t\trm -f \"$fixup_msg\"\n \t\techo\n-\t\tprintf '%s\\n' \"$comment_char This is the $(nth_string $count) commit message:\"\n+\t\tprintf '%s\\n' \"$comment_char $(this_nth_commit_message $count)\"\n \t\techo\n \t\tcommit_message $2\n \t\t;;\n \tfixup)\n \t\techo\n-\t\tprintf '%s\\n' \"$comment_char The $(nth_string $count) commit message will be skipped:\"\n+\t\tprintf '%s\\n' \"$comment_char $(skip_nth_commit_message $count)\"\n \t\techo\n \t\t# Change the space after the comment character to TAB:\n \t\tcommit_message $2 | git stripspace --comment-lines | sed -e 's/ /\t/'\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 9a96e15..25a77ee 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -29,6 +29,7 @@ set_fake_editor () {\n \t*/COMMIT_EDITMSG)\n \t\ttest -z \"$EXPECT_HEADER_COUNT\" ||\n \t\t\ttest \"$EXPECT_HEADER_COUNT\" = \"$(sed -n '1s/^# This is a combination of \\(.*\\) commits\\./\\1/p' < \"$1\")\" ||\n+\t\t\ttest \"# # GETTEXT POISON #\" = \"$(sed -n '1p' < \"$1\")\" ||\n \t\t\texit\n \t\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n \t\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-- \n2.7.3\n"},{"id":"287294","messageId":"1464031661-18988-18-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 17/22] i18n: setup: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:36Z","receivedAt":"2016-05-23T19:27:36Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Update tests that compare the strings newly marked for translation to\nsucceed when running under GETTEXT_POISON.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n setup.c                        | 16 ++++++++--------\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n t/t4208-log-magic-pathspec.sh  |  4 ++--\n 3 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex c86bf5c..6d0e0c9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -157,8 +157,8 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\t\t\t\t int diagnose_misspelt_rev)\n {\n \tif (!diagnose_misspelt_rev)\n-\t\tdie(\"%s: no such path in the working tree.\\n\"\n-\t\t    \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\",\n+\t\tdie(_(\"%s: no such path in the working tree.\\n\"\n+\t\t      \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\"),\n \t\t    arg);\n \t/*\n \t * Saying \"'(icase)foo' does not exist in the index\" when the\n@@ -170,9 +170,9 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\tmaybe_die_on_misspelt_object_name(arg, prefix);\n \n \t/* ... or fall back the most general message. */\n-\tdie(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n \n }\n \n@@ -220,9 +220,9 @@ void verify_non_filename(const char *prefix, const char *arg)\n \t\treturn; /* flag */\n \tif (!check_filename(prefix, arg))\n \t\treturn;\n-\tdie(\"ambiguous argument '%s': both revision and filename\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': both revision and filename\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n }\n \n int get_common_dir(struct strbuf *sb, const char *gitdir)\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 86c2ff2..79a0251 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -106,7 +106,7 @@ test_expect_success 'incorrect revision id' '\n \ttest_must_fail git rev-parse foobar:file.txt 2>error &&\n \tgrep \"Invalid object name '\"'\"'foobar'\"'\"'.\" error &&\n \ttest_must_fail git rev-parse foobar 2> error &&\n-\tgrep \"unknown revision or path not in the working tree.\" error\n+\ttest_i18ngrep \"unknown revision or path not in the working tree.\" error\n '\n \n test_expect_success 'incorrect file in sha1:path' '\ndiff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh\nindex d8f23f4..001343e 100755\n--- a/t/t4208-log-magic-pathspec.sh\n+++ b/t/t4208-log-magic-pathspec.sh\n@@ -18,7 +18,7 @@ test_expect_success '\"git log :/\" should not be ambiguous' '\n test_expect_success '\"git log :/a\" should be ambiguous (applied both rev and worktree)' '\n \t: >a &&\n \ttest_must_fail git log :/a 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success '\"git log :/a -- \" should not be ambiguous' '\n@@ -31,7 +31,7 @@ test_expect_success '\"git log -- :/a\" should not be ambiguous' '\n \n test_expect_success '\"git log :\" should be ambiguous' '\n \ttest_must_fail git log : 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success 'git log -- :' '\n-- \n2.7.3\n"},{"id":"287287","messageId":"1464031661-18988-19-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 18/22] tests: use test_i18n* functions to suppress false positives","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:37Z","receivedAt":"2016-05-23T19:27:37Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The test functions test_i18ncmp and test_i18ngrep pretend success if run\nunder GETTEXT_POISON. By using those functions to test output which is\ncorrectly marked as translatable, enables one to detect if the strings\nnewly marked for translation are from plumbing output. If they are\nindeed from plumbing, the test would fail, and the string should be\nunmarked, since it is not seen by users.\n\nThus, it is productive to not have false positives when running the test\nunder GETTEXT_POISON. This commit replaces normal test functions by\ntheir i18n aware variants in use-cases know to be correctly marked for\ntranslation, suppressing false positives.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t0008-ignores.sh                |  4 ++--\n t/t1300-repo-config.sh            |  8 ++++----\n t/t1307-config-blob.sh            |  2 +-\n t/t1308-config-set.sh             |  4 ++--\n t/t1400-update-ref.sh             |  2 +-\n t/t2010-checkout-ambiguous.sh     |  2 +-\n t/t2018-checkout-branch.sh        |  2 +-\n t/t3200-branch.sh                 |  6 +++---\n t/t3201-branch-contains.sh        |  2 +-\n t/t3320-notes-merge-worktrees.sh  |  2 +-\n t/t5505-remote.sh                 |  2 +-\n t/t5510-fetch.sh                  |  2 +-\n t/t5523-push-upstream.sh          |  4 ++--\n t/t5536-fetch-conflicts.sh        |  4 ++--\n t/t6301-for-each-ref-errors.sh    | 10 +++++-----\n t/t7063-status-untracked-cache.sh |  2 +-\n t/t7102-reset.sh                  |  4 ++--\n t/t7400-submodule-basic.sh        |  2 +-\n t/t7403-submodule-sync.sh         |  4 ++--\n t/t7406-submodule-update.sh       | 10 +++++-----\n t/t7508-status.sh                 |  4 ++--\n 21 files changed, 41 insertions(+), 41 deletions(-)\n\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex 89544dd..43aa2bd 100755\n--- a/t/t0008-ignores.sh\n+++ b/t/t0008-ignores.sh\n@@ -34,7 +34,7 @@ expect_from_stdin () {\n test_stderr () {\n \texpected=\"$1\"\n \texpect_in stderr \"$1\" &&\n-\ttest_cmp \"$HOME/expected-stderr\" \"$HOME/stderr\"\n+\ttest_i18ncmp \"$HOME/expected-stderr\" \"$HOME/stderr\"\n }\n \n broken_c_unquote () {\n@@ -47,7 +47,7 @@ broken_c_unquote_verbose () {\n \n stderr_contains () {\n \tregexp=\"$1\"\n-\tif grep \"$regexp\" \"$HOME/stderr\"\n+\tif test_i18ngrep \"$regexp\" \"$HOME/stderr\"\n \tthen\n \t\treturn 0\n \telse\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex d934a24..923bfc5 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -886,7 +886,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '\n \t\tgit config --get --path path.normal >>result &&\n \t\tgit config --get --path path.trailingtilde >>result\n \t) &&\n-\tgrep \"[Ff]ailed to expand.*~/\" msg &&\n+\ttest_i18ngrep \"[Ff]ailed to expand.*~/\" msg &&\n \ttest_cmp expect result\n '\n \n@@ -1126,7 +1126,7 @@ test_expect_success 'barf on syntax error' '\n \tkey garbage\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 3 \" error\n+\ttest_i18ngrep \" line 3 \" error\n '\n \n test_expect_success 'barf on incomplete section header' '\n@@ -1136,7 +1136,7 @@ test_expect_success 'barf on incomplete section header' '\n \tkey = value\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 2 \" error\n+\ttest_i18ngrep \" line 2 \" error\n '\n \n test_expect_success 'barf on incomplete string' '\n@@ -1146,7 +1146,7 @@ test_expect_success 'barf on incomplete string' '\n \tkey = \"value string\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 3 \" error\n+\ttest_i18ngrep \" line 3 \" error\n '\n \n test_expect_success 'urlmatch' '\ndiff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\nindex 3c6791e..4079fef 100755\n--- a/t/t1307-config-blob.sh\n+++ b/t/t1307-config-blob.sh\n@@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n \n \t# just grep for our token as the exact error message is likely to\n \t# change or be internationalized\n-\tgrep \"HEAD:config\" err\n+\ttest_i18ngrep \"HEAD:config\" err\n '\n \n test_expect_success 'can parse blob ending with CR' '\ndiff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh\nindex 005d66d..cd62063 100755\n--- a/t/t1308-config-set.sh\n+++ b/t/t1308-config-set.sh\n@@ -197,14 +197,14 @@ test_expect_success 'proper error on error in default config files' '\n \techo \"[\" >>.git/config &&\n \techo \"fatal: bad config line 34 in file .git/config\" >expect &&\n \ttest_expect_code 128 test-config get_value foo.bar 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'proper error on error in custom config files' '\n \techo \"[\" >>syntax-error &&\n \techo \"fatal: bad config line 1 in file syntax-error\" >expect &&\n \ttest_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'check line errors for malformed values' '\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex af1b20d..75fa654 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -361,7 +361,7 @@ test_expect_success 'stdin test setup' '\n \n test_expect_success '-z fails without --stdin' '\n \ttest_must_fail git update-ref -z $m $m $m 2>err &&\n-\tgrep \"usage: git update-ref\" err\n+\ttest_i18ngrep \"usage: git update-ref\" err\n '\n \n test_expect_success 'stdin works with no input' '\ndiff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh\nindex 87bdf9c..e76e84a 100755\n--- a/t/t2010-checkout-ambiguous.sh\n+++ b/t/t2010-checkout-ambiguous.sh\n@@ -49,7 +49,7 @@ test_expect_success 'disambiguate checking out from a tree-ish' '\n \n test_expect_success 'accurate error message with more than one ref' '\n \ttest_must_fail git checkout HEAD master -- 2>actual &&\n-\tgrep 2 actual &&\n+\ttest_i18ngrep 2 actual &&\n \ttest_i18ngrep \"one reference expected, 2 given\" actual\n '\n \ndiff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh\nindex 2741262..2131fb2 100755\n--- a/t/t2018-checkout-branch.sh\n+++ b/t/t2018-checkout-branch.sh\n@@ -124,7 +124,7 @@ test_expect_success 'checkout -b to @{-1} fails with the right branch name' '\n \tgit checkout branch2 &&\n \techo  >expect \"fatal: A branch named '\\''branch1'\\'' already exists.\" &&\n \ttest_must_fail git checkout -b @{-1} 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'checkout -B to an existing branch resets branch to HEAD' '\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex f3e3b6c..ac9c764 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -550,7 +550,7 @@ If you wanted to make '\"'master'\"' track '\"'origin/master'\"', do this:\n     git branch -d origin/master\n     git branch --set-upstream-to origin/master\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream with two args only shows the deprecation message' '\n@@ -559,7 +559,7 @@ test_expect_success '--set-upstream with two args only shows the deprecation mes\n \tcat >expected <<EOF &&\n The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream with one arg only shows the deprecation message if the branch existed' '\n@@ -568,7 +568,7 @@ test_expect_success '--set-upstream with one arg only shows the deprecation mess\n \tcat >expected <<EOF &&\n The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '\ndiff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh\nindex 912a663..7f3ec47 100755\n--- a/t/t3201-branch-contains.sh\n+++ b/t/t3201-branch-contains.sh\n@@ -156,7 +156,7 @@ test_expect_success 'branch --merged with --verbose' '\n \t* topic  2c939f4 [ahead 1] foo\n \t  zzz    c77a0a9 second on master\n \tEOF\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_done\ndiff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh\nindex 1f71d58..522157b 100755\n--- a/t/t3320-notes-merge-worktrees.sh\n+++ b/t/t3320-notes-merge-worktrees.sh\n@@ -52,7 +52,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '\n \t\tcd worktree &&\n \t\tgit config core.notesRef refs/notes/y &&\n \t\ttest_must_fail git notes merge z 2>err &&\n-\t\tgrep \"A notes merge into refs/notes/y is already in-progress at\" err\n+\t\ttest_i18ngrep \"A notes merge into refs/notes/y is already in-progress at\" err\n \t) &&\n \ttest_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF\n '\ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex dd2e6ce..8198d8e 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -1182,7 +1182,7 @@ test_expect_success 'extra args: setup' '\n test_extra_arg () {\n \ttest_expect_success \"extra args: $*\" \"\n \t\ttest_must_fail git remote $* bogus_extra_arg 2>actual &&\n-\t\tgrep '^usage:' actual\n+\t\ttest_i18ngrep '^usage:' actual\n \t\"\n }\n \ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex 454d896..88076da 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -644,7 +644,7 @@ test_expect_success 'fetch --prune prints the remotes url' '\n \t\tgit fetch --prune origin 2>&1 | head -n1 >../actual\n \t) &&\n \techo \"From ${D}/.\" >expect &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'branchname D/F conflict resolved by --prune' '\ndiff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh\nindex 3683df1..4a7b98b 100755\n--- a/t/t5523-push-upstream.sh\n+++ b/t/t5523-push-upstream.sh\n@@ -75,7 +75,7 @@ test_expect_success TTY 'progress messages go to tty' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u upstream master >out 2>err &&\n-\tgrep \"Writing objects\" err\n+\ttest_i18ngrep \"Writing objects\" err\n '\n \n test_expect_success 'progress messages do not go to non-tty' '\n@@ -91,7 +91,7 @@ test_expect_success 'progress messages go to non-tty (forced)' '\n \n \t# force progress messages to stderr, even though it is non-tty\n \tgit push -u --progress upstream master >out 2>err &&\n-\tgrep \"Writing objects\" err\n+\ttest_i18ngrep \"Writing objects\" err\n '\n \n test_expect_success TTY 'push -q suppresses progress' '\ndiff --git a/t/t5536-fetch-conflicts.sh b/t/t5536-fetch-conflicts.sh\nindex 6c5d3a4..2e42cf3 100755\n--- a/t/t5536-fetch-conflicts.sh\n+++ b/t/t5536-fetch-conflicts.sh\n@@ -22,8 +22,8 @@ verify_stderr () {\n \tcat >expected &&\n \t# We're not interested in the error\n \t# \"fatal: The remote end hung up unexpectedly\":\n-\tgrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&\n-\ttest_cmp expected actual\n+\ttest_i18ngrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&\n+\ttest_i18ncmp expected actual\n }\n \n test_expect_success 'setup' '\ndiff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh\nindex cdb67a0..c734ce2 100755\n--- a/t/t6301-for-each-ref-errors.sh\n+++ b/t/t6301-for-each-ref-errors.sh\n@@ -20,8 +20,8 @@ test_expect_success 'Broken refs are reported correctly' '\n \ttest_when_finished \"rm -f .git/$r\" &&\n \techo \"warning: ignoring broken ref $r\" >broken-err &&\n \tgit for-each-ref >out 2>err &&\n-\ttest_cmp full-list out &&\n-\ttest_cmp broken-err err\n+\ttest_i18ncmp full-list out &&\n+\ttest_i18ncmp broken-err err\n '\n \n test_expect_success 'NULL_SHA1 refs are reported correctly' '\n@@ -31,10 +31,10 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '\n \techo \"warning: ignoring broken ref $r\" >zeros-err &&\n \tgit for-each-ref >out 2>err &&\n \ttest_cmp full-list out &&\n-\ttest_cmp zeros-err err &&\n+\ttest_i18ncmp zeros-err err &&\n \tgit for-each-ref --format=\"%(objectname) %(refname)\" >brief-out 2>brief-err &&\n \ttest_cmp brief-list brief-out &&\n-\ttest_cmp zeros-err brief-err\n+\ttest_i18ncmp zeros-err brief-err\n '\n \n test_expect_success 'Missing objects are reported correctly' '\n@@ -43,7 +43,7 @@ test_expect_success 'Missing objects are reported correctly' '\n \ttest_when_finished \"rm -f .git/$r\" &&\n \techo \"fatal: missing object $MISSING for $r\" >missing-err &&\n \ttest_must_fail git for-each-ref 2>err &&\n-\ttest_cmp missing-err err &&\n+\ttest_i18ncmp missing-err err &&\n \t(\n \t\tcat brief-list &&\n \t\techo \"$MISSING $r\"\ndiff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\nindex a971884..38b3890 100755\n--- a/t/t7063-status-untracked-cache.sh\n+++ b/t/t7063-status-untracked-cache.sh\n@@ -643,7 +643,7 @@ test_expect_success 'test ident field is working' '\n \tcp -R done dthree dtwo four three ../other_worktree &&\n \tGIT_WORK_TREE=../other_worktree git status 2>../err &&\n \techo \"warning: Untracked cache is disabled on this system or location.\" >../expect &&\n-\ttest_cmp ../expect ../err\n+\ttest_i18ncmp ../expect ../err\n '\n \n test_done\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 98bcfe2..86f23be 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -66,14 +66,14 @@ test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-\ttest_cmp .expected .actual\n+\ttest_i18ncmp .expected .actual\n '\n \n test_expect_success 'reset --hard message (ISO8859-1 logoutputencoding)' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit -c \"i18n.logOutputEncoding=$test_encoding\" reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&\n-\ttest_cmp .expected .actual\n+\ttest_i18ncmp .expected .actual\n '\n \n >.diff_expect\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 3570f7b..b77cce8 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -942,7 +942,7 @@ test_expect_success 'submodule deinit from subdirectory' '\n \t\tcd sub &&\n \t\tgit submodule deinit ../init >../output\n \t) &&\n-\tgrep \"\\\\.\\\\./init\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./init\" output &&\n \ttest -z \"$(git config --get-regexp \"submodule\\.example\\.\")\" &&\n \ttest -n \"$(git config --get-regexp \"submodule\\.example2\\.\")\" &&\n \ttest -f example2/.git &&\ndiff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh\nindex 79bc135..b8690b1 100755\n--- a/t/t7403-submodule-sync.sh\n+++ b/t/t7403-submodule-sync.sh\n@@ -157,7 +157,7 @@ test_expect_success '\"git submodule sync\" should update submodule URLs - subdire\n \t\tcd sub &&\n \t\tgit submodule sync >../../output\n \t) &&\n-\tgrep \"\\\\.\\\\./submodule\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./submodule\" output &&\n \ttest -d \"$(\n \t\tcd super-clone/submodule &&\n \t\tgit config remote.origin.url\n@@ -188,7 +188,7 @@ test_expect_success '\"git submodule sync --recursive\" should update all submodul\n \t\tcd sub &&\n \t\tgit submodule sync --recursive >../../output\n \t) &&\n-\tgrep \"\\\\.\\\\./submodule/sub-submodule\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./submodule/sub-submodule\" output &&\n \ttest -d \"$(\n \t\tcd super-clone/submodule &&\n \t\tgit config remote.origin.url\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex 5f27879..88e9750 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -136,8 +136,8 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '\n \t cd tmp &&\n \t git submodule update --init --recursive ../super >../../actual 2>../../actual2\n \t) &&\n-\ttest_cmp expect actual &&\n-\ttest_cmp expect2 actual2\n+\ttest_i18ncmp expect actual &&\n+\ttest_i18ncmp expect2 actual2\n '\n \n apos=\"'\";\n@@ -370,7 +370,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'\n \t(cd super &&\n \t test_must_fail git submodule update submodule 2>../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n cat << EOF >expect\n@@ -388,7 +388,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -\n \t mkdir tmp && cd tmp &&\n \t test_must_fail git submodule update ../submodule 2>../../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n cat << EOF >expect\n@@ -408,7 +408,7 @@ test_expect_success 'recursive submodule update - command in .git/config catches\n \t mkdir -p tmp && cd tmp &&\n \t test_must_fail git submodule update --recursive ../super 2>../../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n test_expect_success 'submodule init does not copy command into .git/config' '\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex c3ed7cb..b3bdd16 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -1377,7 +1377,7 @@ EOF\n \tgit config --add -f .gitmodules submodule.subname.ignore all &&\n \tgit config --add -f .gitmodules submodule.subname.path sm &&\n \tgit status > output &&\n-\ttest_cmp expect output &&\n+\ttest_i18ncmp expect output &&\n \tgit config -f .gitmodules  --remove-section submodule.subname\n '\n \n@@ -1387,7 +1387,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar\n \tgit config --add submodule.subname.ignore all &&\n \tgit config --add submodule.subname.path sm &&\n \tgit status > output &&\n-\ttest_cmp expect output &&\n+\ttest_i18ncmp expect output &&\n \tgit config --remove-section submodule.subname &&\n \tgit config -f .gitmodules  --remove-section submodule.subname\n '\n-- \n2.7.3\n"},{"id":"287288","messageId":"1464031661-18988-20-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 19/22] tests: unpack-trees: update to use test_i18n* functions","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:38Z","receivedAt":"2016-05-23T19:27:38Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Use functions test_i18ncmp and test_i18ngrep to successfully pass tests\nrunning under GETTEXT_POISON.\n\nThe output strings compared to in these test were marked for translation\nin ed47fdf (\"i18n: unpack-trees: mark strings for translation\",\n2016-04-09) and later improved in 2e3926b (\"i18n: unpack-trees: avoid\nsubstituting only a verb in sentences\", 2016-05-12).\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t1011-read-tree-sparse-checkout.sh | 2 +-\n t/t3400-rebase.sh                    | 4 ++--\n t/t3404-rebase-interactive.sh        | 4 ++--\n t/t7607-merge-overwrite.sh           | 2 +-\n 4 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex 0c74bee..3583105 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -247,7 +247,7 @@ error: The following untracked working tree files would be overwritten by checko\n Please move or remove them before you can switch branches.\n Aborting\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success 'checkout without --ignore-skip-worktree-bits' '\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex 47b5682..f5fd15e 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -136,8 +136,8 @@ test_expect_success 'setup: recover' '\n test_expect_success 'Show verbose error when HEAD could not be detached' '\n \t>B &&\n \ttest_must_fail git rebase topic 2>output.err >output.out &&\n-\tgrep \"The following untracked working tree files would be overwritten by checkout:\" output.err &&\n-\tgrep B output.err\n+\ttest_i18ngrep \"The following untracked working tree files would be overwritten by checkout:\" output.err &&\n+\ttest_i18ngrep B output.err\n '\n rm -f B\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex f4ccd10..8ac1868 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -219,9 +219,9 @@ test_expect_success 'abort with error when new base cannot be checked out' '\n \tgit commit -m \"remove file in base\" &&\n \tset_fake_editor &&\n \ttest_must_fail git rebase -i master > output 2>&1 &&\n-\tgrep \"The following untracked working tree files would be overwritten by checkout:\" \\\n+\ttest_i18ngrep \"The following untracked working tree files would be overwritten by checkout:\" \\\n \t\toutput &&\n-\tgrep \"file1\" output &&\n+\ttest_i18ngrep \"file1\" output &&\n \ttest_path_is_missing .git/rebase-merge &&\n \tgit reset --hard HEAD^\n '\ndiff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh\nindex 758a623..e8ec54c 100755\n--- a/t/t7607-merge-overwrite.sh\n+++ b/t/t7607-merge-overwrite.sh\n@@ -125,7 +125,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '\n \tcp important sub &&\n \tcp important sub2 &&\n \ttest_must_fail git merge sub 2>out &&\n-\ttest_cmp out expect &&\n+\ttest_i18ncmp out expect &&\n \ttest_path_is_missing .git/MERGE_HEAD &&\n \ttest_cmp important sub &&\n \ttest_cmp important sub2 &&\n-- \n2.7.3\n"},{"id":"287286","messageId":"1464031661-18988-21-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 20/22] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:39Z","receivedAt":"2016-05-23T19:27:39Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The test t9003-help-autocorrect.sh fails when run under GETTEXT_POISON,\nbecause it's expecting to filter out the original output. Accommodate\ngettext poison case by also filtering out the default simulated output.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n\nThat is a TAB between '^' and 'l' and likewise to the next instance.\n\n t/t9003-help-autocorrect.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\nindex dfe95c9..b1c7919 100755\n--- a/t/t9003-help-autocorrect.sh\n+++ b/t/t9003-help-autocorrect.sh\n@@ -31,10 +31,10 @@ test_expect_success 'autocorrect showing candidates' '\n \tgit config help.autocorrect 0 &&\n \n \ttest_must_fail git lfg 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual | grep lgf &&\n+\tgrep \"^\tlgf\" actual &&\n \n \ttest_must_fail git distimdist 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual | grep distimdistim\n+\tgrep \"^\tdistimdistim\" actual\n '\n \n test_expect_success 'autocorrect running commands' '\n-- \n2.7.3\n"},{"id":"287290","messageId":"1464031661-18988-22-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 21/22] t4153: fix negated test_i18ngrep call","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:40Z","receivedAt":"2016-05-23T19:27:40Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The function test_i18ngrep fakes success when run under GETTEXT_POISON.\nHence, running in the following manner will always fail under gettext\npoison:\n\n\t! test_i18ngrep expected actual\n\nUse correct syntax: test_i18ngrep ! expected actual\n\nFor other instance of this issue see 41ca19b (\"tests: fix negated\ntest_i18ngrep calls\", 2014-08-13).\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t4153-am-resume-override-opts.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh\nindex 7c013d8..8ea22d1 100755\n--- a/t/t4153-am-resume-override-opts.sh\n+++ b/t/t4153-am-resume-override-opts.sh\n@@ -53,7 +53,7 @@ test_expect_success '--no-quiet overrides --quiet' '\n \t# Applying side1 will be quiet.\n \ttest_must_fail git am --quiet side[123].eml >out &&\n \ttest_path_is_dir .git/rebase-apply &&\n-\t! test_i18ngrep \"^Applying: \" out &&\n+\ttest_i18ngrep ! \"^Applying: \" out &&\n \techo side1 >file &&\n \tgit add file &&\n \n-- \n2.7.3\n"},{"id":"287292","messageId":"1464031661-18988-23-git-send-email-vascomalmeida@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v2 22/22] t5523: use test_i18ngrep for negation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-23T19:27:41Z","receivedAt":"2016-05-23T19:27:41Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Replace the first form by the second one:\n\t! grep expected actual\n\ttest_i18ngrep ! expected actual\n\nThe latter syntax is supported by test_i18ngrep defined in\nt/test-lib.sh.\n\nAlthough the test already passes whether GETTEXT_POSION is enabled, use\nthe i18n grep variant for the sake of consistency and also to make\nobvious that those strings are subject to i18n.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t5523-push-upstream.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh\nindex 4a7b98b..d6981ba 100755\n--- a/t/t5523-push-upstream.sh\n+++ b/t/t5523-push-upstream.sh\n@@ -83,7 +83,7 @@ test_expect_success 'progress messages do not go to non-tty' '\n \n \t# skip progress messages, since stderr is non-tty\n \tgit push -u upstream master >out 2>err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success 'progress messages go to non-tty (forced)' '\n@@ -98,15 +98,15 @@ test_expect_success TTY 'push -q suppresses progress' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u -q upstream master >out 2>err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success TTY 'push --no-progress suppresses progress' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u --no-progress upstream master >out 2>err &&\n-\t! grep \"Unpacking objects\" err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Unpacking objects\" err &&\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success TTY 'quiet push' '\n-- \n2.7.3\n"},{"id":"287494","messageId":"5745A501.2040605@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-16-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 15/22] i18n: rebase-interactive: mark here-doc strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-25T13:13:37Z","receivedAt":"2016-05-25T13:13:37Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 19:27 de 23-05-2016, Vasco Almeida escreveu:\n> Add eval_ngettext dummy function to be called by tests when running\n> under GETTEXT_POISON. Otherwise, tests would fail under gettext poison\n> because that function could not be found.\n> \n> [...]\n>\n> diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\n> index e6c3116..c14c303 100644\n> --- a/git-sh-i18n.sh\n> +++ b/git-sh-i18n.sh\n> @@ -64,6 +64,10 @@ poison)\n>  \teval_gettext () {\n>  \t\tprintf \"%s\" \"# GETTEXT POISON #\"\n>  \t}\n> +\n> +\teval_ngettext () {\n> +\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n> +\t}\n>  \t;;\n>  *)\n>  \tgettext () {\n\nPerhaps, I should have added more eval_ngettext dummy functions in other\nplaces in this file. Not exclusively to the poison part of the switch case.\n\nI see Solaris is a special case (gettext_without_eval_gettext), does it\nhave eval_ngettext? Probably not, since it does not have\neval_gettext(1). In such case, we would call ngettext like it's done for\neval_gettext, assuming Solaris has ngettext.\n\nThe relevant part of git-sh-i18n.sh updated with this patch:\n\n# ... and then follow that decision.\ncase \"$GIT_INTERNAL_GETTEXT_SH_SCHEME\" in\ngnu)\n\t# Use libintl's gettext.sh, or fall back to English if we can't.\n\t. gettext.sh\n\t;;\ngettext_without_eval_gettext)\n\t# Solaris has a gettext(1) but no eval_gettext(1)\n\teval_gettext () {\n\t\tgettext \"$1\" | (\n\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n\t\t\tgit sh-i18n--envsubst \"$1\"\n\t\t)\n\t}\n\t;;\npoison)\n\t# Emit garbage so that tests that incorrectly rely on translatable\n\t# strings will fail.\n\tgettext () {\n\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n\t}\n\n\teval_gettext () {\n\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n\t}\n\n\teval_ngettext () {\n\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n\t}\n\t;;\n*)\n\tgettext () {\n\t\tprintf \"%s\" \"$1\"\n\t}\n\n\teval_gettext () {\n\t\tprintf \"%s\" \"$1\" | (\n\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$1\");\n\t\t\tgit sh-i18n--envsubst \"$1\"\n\t\t)\n\t}\n\t;;\nesac\n"},{"id":"287621","messageId":"xmqqwpmgtpli.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"1464031661-18988-17-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 16/22] i18n: rebase-interactive: mark comments of squash for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-26T22:35:21Z","receivedAt":"2016-05-26T22:35:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Helper functions this_nth_commit_message and skip_nth_commit_message\n> replace the previous method of making the comment messages (such as\n> \"This is the 2nd commit message:\") aided by nth_string helper function.\n> This step was taken as a workaround to enabled translation of entire\n> sentences. However, doesn't change any text seen in English by the user,\n> except for string \"The first commit's message is:\" which was changed to\n> match the style of other instances.\n\nIf only the original were written as \"This is the commit message\n$N\", you didn't have to do a lot of work like this, but such is\nlife.  Thanks for working on this.\n"},{"id":"287622","messageId":"xmqqpos8tpjo.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"1464031661-18988-15-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 14/22] i18n: rebase-interactive: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-26T22:36:27Z","receivedAt":"2016-05-26T22:36:27Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> @@ -222,9 +223,10 @@ has_action () {\n>  }\n>  \n>  is_empty_commit() {\n> -\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n> -\t\tdie \"$1: not a commit that can be picked\")\n> -\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n> +\tsha1=$1\n> +\ttree=$(git rev-parse -q --verify \"$sha1\"^{tree} 2>/dev/null ||\n> +\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\")\n> +\tptree=$(git rev-parse -q --verify \"$sha1\"^^{tree} 2>/dev/null ||\n>  \t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n>  \ttest \"$tree\" = \"$ptree\"\n>  }\n\nBoth of the two callsites of this function use the variable $sha1,\nand at least one of them uses that variable after this function\nreturns, but they pass it as the first parameter to this function,\nso the assignment added by this patch does not break them, which is\ngood.\n"},{"id":"287623","messageId":"xmqqk2igtp2e.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"1464031661-18988-14-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 13/22] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-26T22:46:49Z","receivedAt":"2016-05-26T22:46:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n>  require_work_tree_exists () {\n> +\tprogram_name=$0\n>  \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n>  \tthen\n> -\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n> +\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n>  \tfi\n>  }\n\nThis is probably quite a minor point, but I'd prefer if clobbering\nthe variable program_name is done between \"then\" and \"fi\", i.e. when\nwe know we are going to die, so the caller would not care.  Because\nwe are not in control of the caller's namespace use, and we do not\nwant bash-ism \"local\" here, that is the best we could do to make it\nsafer.\n\n>  require_work_tree () {\n> +\tprogram_name=$0\n\nSame here.\n\n>  \ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true ||\n> -\tdie \"fatal: $0 cannot be used without a working tree.\"\n> +\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n>  }\n>  \n>  require_clean_work_tree () {\n> +\taction=$1\n> +\thint=$2\n\nLikewise.\n"},{"id":"287666","messageId":"57481CA0.5080801@sapo.pt","threadId":"42425","inReplyTo":"xmqqpos8tpjo.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 14/22] i18n: rebase-interactive: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-27T10:08:32Z","receivedAt":"2016-05-27T10:08:32Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 22:36 de 26-05-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> @@ -222,9 +223,10 @@ has_action () {\n>>  }\n>>  \n>>  is_empty_commit() {\n>> -\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n>> -\t\tdie \"$1: not a commit that can be picked\")\n>> -\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n>> +\tsha1=$1\n>> +\ttree=$(git rev-parse -q --verify \"$sha1\"^{tree} 2>/dev/null ||\n>> +\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\")\n>> +\tptree=$(git rev-parse -q --verify \"$sha1\"^^{tree} 2>/dev/null ||\n>>  \t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n>>  \ttest \"$tree\" = \"$ptree\"\n>>  }\n> \n> Both of the two callsites of this function use the variable $sha1,\n> and at least one of them uses that variable after this function\n> returns, but they pass it as the first parameter to this function,\n> so the assignment added by this patch does not break them, which is\n> good.\n> \nI didn't know that. I can change sha1=$1 to local_sha1=$1 or _sha1=$1 (I\ndon't know what is the convention here) if that is safer, avoiding using\nthe bash-ism \"local\" keyword, and preventing future distractions.\n"},{"id":"287667","messageId":"57481EB7.10809@sapo.pt","threadId":"42425","inReplyTo":"xmqqk2igtp2e.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 13/22] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-27T10:17:27Z","receivedAt":"2016-05-27T10:17:27Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 22:46 de 26-05-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> >  require_work_tree_exists () {\n>> > +\tprogram_name=$0\n>> >  \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n>> >  \tthen\n>> > -\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n>> > +\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n>> >  \tfi\n>> >  }\n> This is probably quite a minor point, but I'd prefer if clobbering\n> the variable program_name is done between \"then\" and \"fi\", i.e. when\n> we know we are going to die, so the caller would not care.  Because\n> we are not in control of the caller's namespace use, and we do not\n> want bash-ism \"local\" here, that is the best we could do to make it\n> safer.\n> \nI was not aware about this issue. I agree with you and I'll fix this and\nother instances you mentioned, in the next re-roll.\n"},{"id":"287668","messageId":"5748231B.8080609@sapo.pt","threadId":"42425","inReplyTo":"xmqqwpmgtpli.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 16/22] i18n: rebase-interactive: mark comments of squash for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-27T10:36:11Z","receivedAt":"2016-05-27T10:36:11Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 22:35 de 26-05-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> Helper functions this_nth_commit_message and skip_nth_commit_message\n>> replace the previous method of making the comment messages (such as\n>> \"This is the 2nd commit message:\") aided by nth_string helper function.\n>> This step was taken as a workaround to enabled translation of entire\n>> sentences. However, doesn't change any text seen in English by the user,\n>> except for string \"The first commit's message is:\" which was changed to\n>> match the style of other instances.\n> \n> If only the original were written as \"This is the commit message\n> $N\", you didn't have to do a lot of work like this, but such is\n> life.  Thanks for working on this.\n> \nI did that work, assuming it was important and we wanted to keep the\nexisting messages as much as possible. Unless they are out of place, as\nit felt about the message I changed. I've assumed that based on the user\nbeing used to those messages and eventual scripts that expected those\nmessages.\nIs my assumption right? Anyway, the work is already done.\n"},{"id":"287689","messageId":"xmqqk2ifsajn.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"57481CA0.5080801@sapo.pt","subject":"Re: [PATCH v2 14/22] i18n: rebase-interactive: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-27T16:58:04Z","receivedAt":"2016-05-27T16:58:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n>>>  is_empty_commit() {\n>>> -\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n>>> -\t\tdie \"$1: not a commit that can be picked\")\n>>> -\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n>>> +\tsha1=$1\n>>> +\ttree=$(git rev-parse -q --verify \"$sha1\"^{tree} 2>/dev/null ||\n>>> +\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\")\n>>> +\tptree=$(git rev-parse -q --verify \"$sha1\"^^{tree} 2>/dev/null ||\n>>>  \t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n>>>  \ttest \"$tree\" = \"$ptree\"\n>>>  }\n>> \n>> Both of the two callsites of this function use the variable $sha1,\n>> and at least one of them uses that variable after this function\n>> returns, but they pass it as the first parameter to this function,\n>> so the assignment added by this patch does not break them, which is\n>> good.\n>> \n> I didn't know that. I can change sha1=$1 to local_sha1=$1 or _sha1=$1 (I\n> don't know what is the convention here) if that is safer, avoiding using\n> the bash-ism \"local\" keyword, and preventing future distractions.\n\nI do not think it is necessary to do any of the changes for this\none, which is only used locally in this file.  They just need to be\ncareful when they add or modify the callers.\n\nEven if it is renamed $local_sha1, they will still need to be\ncareful anyway, because the only way they _can_ break or be broken\nby your patch is when they somehow decide to pass something that is\nnot called $sha1 to this function, i.e. they would be changing the\ncallsite---which they must be doing for a reason and would also\ninvolve change to the code what happens after this function returns.\nIf they start using $local_sha1 there, they would be broken if you\nrenamed it today, and if they use $sha1 there, they would be broken\nif you didn't---so they have to be careful and check what this one\nclobbers _anyway_.  \n\nIOW, a solution that clobbers _some_ variable cannot be made safer\nby renaming.  The callers always have to be careful not to be\naffected.\n\nYou could do something like this, though.  I _think_ the original\nthat calls \"die\" inside $() is broken anyway, so it probably is a\ngood change regardless.\n\n git-rebase--interactive.sh | 6 ++++--\n 1 file changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 9d2bfb7..b5113d6 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -222,8 +222,10 @@ has_action () {\n }\n \n is_empty_commit() {\n-\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n-\t\tdie \"$1: not a commit that can be picked\")\n+\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null) || {\n+\t\tsha1=$1\n+\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\"\n+\t}\n \tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n \t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n \ttest \"$tree\" = \"$ptree\"\n"},{"id":"287691","messageId":"xmqqd1o7sa30.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"1464031661-18988-19-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 18/22] tests: use test_i18n* functions to suppress false positives","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-27T17:08:03Z","receivedAt":"2016-05-27T17:08:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\n> index 3c6791e..4079fef 100755\n> --- a/t/t1307-config-blob.sh\n> +++ b/t/t1307-config-blob.sh\n> @@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n>  \n>  \t# just grep for our token as the exact error message is likely to\n>  \t# change or be internationalized\n> -\tgrep \"HEAD:config\" err\n> +\ttest_i18ngrep \"HEAD:config\" err\n>  '\n\nIt is unfortunate that the gettext-poison mechanism is too dumb to\nnotice that it is clobbering a format string with placeholders and\nleave them intact, which is what the comment above this change is\nwishing for.  I do not think we will be granting that wish any time\nsoon, so perhaps remove the two lines while we are at it?\n"},{"id":"287692","messageId":"xmqq8tyvs9xf.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"1464031661-18988-1-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 00/22] i18n and test updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-27T17:11:24Z","receivedAt":"2016-05-27T17:11:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Marks several messages for translation and updates tests to pass under\n> GETTEXT_POISON. Some tests were updated to fit previous i18n marks, others\n> were updated to fit marks made by these patches. Patches that only touch\n> test file refer to marks done in commits previous to these ones.\n\nWhew, this series is quite a lot of work.\n\nMost of the changes I only skimmed so if you had typos I wouldn't\nhave noticed them, but they looked good from my cursory reading.\n\nI looked at the changes to scripted Porcelains more carefully than\nother changes, and they all looked good (except for the parts I sent\nreviews separately for).\n\nThanks.\n"},{"id":"287709","messageId":"5748A13A.6070608@sapo.pt","threadId":"42425","inReplyTo":"xmqqd1o7sa30.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 18/22] tests: use test_i18n* functions to suppress false positives","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-27T19:34:18Z","receivedAt":"2016-05-27T19:34:18Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:08 de 27-05-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\n>> index 3c6791e..4079fef 100755\n>> --- a/t/t1307-config-blob.sh\n>> +++ b/t/t1307-config-blob.sh\n>> @@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n>>  \n>>  \t# just grep for our token as the exact error message is likely to\n>>  \t# change or be internationalized\n>> -\tgrep \"HEAD:config\" err\n>> +\ttest_i18ngrep \"HEAD:config\" err\n>>  '\n> \n> It is unfortunate that the gettext-poison mechanism is too dumb to\n> notice that it is clobbering a format string with placeholders and\n> leave them intact, which is what the comment above this change is\n> wishing for.  I do not think we will be granting that wish any time\n> soon, so perhaps remove the two lines while we are at it?\n> \nYes, that was more or less what I thought when read that comment, but\nforgot about it after.\nI'll remove that comment in the next re-roll. Also, because it can be\ndeceiving for someone not entirely sure how does gettext poison,\ntranslations and tests work together when test are run.\n\nFor the record, test are run under C locale, so translations don't\nmatter in tests. Under GETTEXT_POISON build, all strings interpolated by\ngettext (for instance _(\"a message from git\") in C language) are\nreplaced by garbage string \"# GETTEXT POISON #\".\n"},{"id":"287710","messageId":"xmqq37p3qnyt.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"5748A13A.6070608@sapo.pt","subject":"Re: [PATCH v2 18/22] tests: use test_i18n* functions to suppress false positives","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-27T19:51:06Z","receivedAt":"2016-05-27T19:51:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Às 17:08 de 27-05-2016, Junio C Hamano escreveu:\n>> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>> \n>>> diff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\n>>> index 3c6791e..4079fef 100755\n>>> --- a/t/t1307-config-blob.sh\n>>> +++ b/t/t1307-config-blob.sh\n>>> @@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n>>>  \n>>>  \t# just grep for our token as the exact error message is likely to\n>>>  \t# change or be internationalized\n>>> -\tgrep \"HEAD:config\" err\n>>> +\ttest_i18ngrep \"HEAD:config\" err\n>>>  '\n>> \n>> It is unfortunate that the gettext-poison mechanism is too dumb to\n>> notice that it is clobbering a format string with placeholders and\n>> leave them intact, which is what the comment above this change is\n>> wishing for.  I do not think we will be granting that wish any time\n>> soon, so perhaps remove the two lines while we are at it?\n>> \n> Yes, that was more or less what I thought when read that comment, but\n> forgot about it after.\n> I'll remove that comment in the next re-roll. Also, because it can be\n> deceiving for someone not entirely sure how does gettext poison,\n> translations and tests work together when test are run.\n>\n> For the record, test are run under C locale, so translations don't\n> matter in tests. Under GETTEXT_POISON build, all strings interpolated by\n> gettext (for instance _(\"a message from git\") in C language) are\n> replaced by garbage string \"# GETTEXT POISON #\".\n\nYes, for the record (as I know you know I know you know this), if we\never granted the wish the comment expressed, we do not have to use\ntest_i18ngrep but instead can use grep, following the reasoning in\nthe comment \"Even when running under poison locale, we must have\nHEAD:config in the output\".\n\nIt is unfortunate that poison locale is not that smart.  If it were,\nwe can lose a lot of test_i18ngrep, not only from here.\n"},{"id":"287727","messageId":"57495473.2010903@sapo.pt","threadId":"42425","inReplyTo":"xmqq8tyvs9xf.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v2 00/22] i18n and test updates","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-28T08:18:59Z","receivedAt":"2016-05-28T08:18:59Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:11 de 27-05-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> Marks several messages for translation and updates tests to pass under\n>> GETTEXT_POISON. Some tests were updated to fit previous i18n marks, others\n>> were updated to fit marks made by these patches. Patches that only touch\n>> test file refer to marks done in commits previous to these ones.\n> \n> Whew, this series is quite a lot of work.\n> \nDo you mean review work?\nSubmitting patches is still a new thing for me.\nI don't know how to organize or split well the patch series, if they're\ntoo long, in order to make other's work easier and the patches\nthemselves more appealing.\n\nI have got other patches that I've made on top of these ones, but\ndon't know whether I should 1) rebase them on top of master, if they\napply cleanly, and send them in a new patch series, or just 2) send them\ntogether in the next re-roll. New patches are also about i18n.\n\nI've tried scavenging mailing list and documentation (not too hard, I\nconfess) for a explicit hint on this and eventually other best/desired\npractices but found nothing so far, beside the content of\nDocumentation/SubmittingPatches of course.\nIf somebody could point me to something like that, that would be great.\n\nI also naturally expect that, if I'm doing something wrong or lesser,\nsomeone will bring it to my attention so I can correct.\n\n(The first time I've sent patches here, I then sent 2 more patches alone\nin their own series [1], but Junio Hamano put them together in one\nva/i18n-misc-updates branch, reasonable decision since that and the\nprevious series were all i18n patches, hence all related. That made me\nsuspect that option 2) is better.\nAfter that, I've sent a re-roll of first series, and Junio Hamano\nthought for a moment that I had dropped the 2 patches from the second\none [2]. So it seems that, at least in this case, option 1) can\nconfuse people.)\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/291386\n[2]\nhttp://thread.gmane.org/gmane.comp.version-control.git/291860/focus=291914\n"},{"id":"287768","messageId":"xmqqeg8kpg3u.fsf@gitster.mtv.corp.google.com","threadId":"42425","inReplyTo":"57495473.2010903@sapo.pt","subject":"Re: [PATCH v2 00/22] i18n and test updates","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-30T00:03:01Z","receivedAt":"2016-05-30T00:03:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Às 17:11 de 27-05-2016, Junio C Hamano escreveu:\n>> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>> \n>>> Marks several messages for translation and updates tests to pass under\n>>> GETTEXT_POISON. Some tests were updated to fit previous i18n marks, others\n>>> were updated to fit marks made by these patches. Patches that only touch\n>>> test file refer to marks done in commits previous to these ones.\n>> \n>> Whew, this series is quite a lot of work.\n>> \n> Do you mean review work?\n\nIf I answered No to \"Was it a lot of work to review it?\", then I'd\nbe lying ;-)\n\nBut my comment was \"Whew, it must have been a lot of work to prepare\nthis series; thanks for tackling the topic\".\n"},{"id":"287807","messageId":"574C1E0E.6040808@sapo.pt","threadId":"42425","inReplyTo":"1464031661-18988-3-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v2 02/22] i18n: advice: mark string about detached head for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-30T11:03:42Z","receivedAt":"2016-05-30T11:03:42Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 19:27 de 23-05-2016, Vasco Almeida escreveu:\n> Mark string with advice seen by the user when in detached head.\n> \n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n> ---\n>  advice.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/advice.c b/advice.c\n> index 4dc5cf1..703a847 100644\n> --- a/advice.c\n> +++ b/advice.c\n> @@ -107,13 +107,13 @@ void NORETURN die_conclude_merge(void)\n>  void detach_advice(const char *new_name)\n>  {\n>  \tconst char fmt[] =\n> -\t\"Note: checking out '%s'.\\n\\n\"\n> +\tN_(\"Note: checking out '%s'.\\n\\n\"\n>  \t\"You are in 'detached HEAD' state. You can look around, make experimental\\n\"\n>  \t\"changes and commit them, and you can discard any commits you make in this\\n\"\n>  \t\"state without impacting any branches by performing another checkout.\\n\\n\"\n>  \t\"If you want to create a new branch to retain commits you create, you may\\n\"\n>  \t\"do so (now or later) by using -b with the checkout command again. Example:\\n\\n\"\n> -\t\"  git checkout -b <new-branch-name>\\n\\n\";\n> +\t\"  git checkout -b <new-branch-name>\\n\\n\");\n>  \n>  \tfprintf(stderr, fmt, new_name);\n>  }\n> \nI just realized this does nothing but letting xgettext extract the\nstring. Does not allow interpolating the actual translation. Hence, the\ntranslator would translate this text but the translation would never be\nused.\n\nThere are 2 solutions: 1) use const char *fmt = _(\"...\") instead\n2) still use N_() like this patch but do fprintf(stderr, _(fmt),\nnew_name); to trigger retrieving the translation when printing the message.\n\nOption 1) it most common on git source and 2) is used primarily during\ncommand line option parse (see usage_with_options_internal() in\nparse-options.c).\n\nI prefer the solution 1) and I'll choose it if there are no objections.\n"}]}