git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2016, 20:30 UTC
Message-ID
<xmqqd1o0y7m0.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqvb1sydmu.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 6 quoted lines
> That is correct, but doesn't that hint that the current users of
> git-sh-i18n no longer have to (and they probably do not want to)
> dot-source it, as they are already dot-sourcing git-sh-setup?
>
> Otherwise they will waste cycles reading the same thing twice
> (assuming that git-sh-i18n is safely read twice, that is).
This part still stands.

If we assume that it is a good idea to i18n shell functions that are supplied by git-sh-setup, it might be a better direction to retire git-sh-i18n and include its text directly in git-sh-setup, so that any scripted Porcelain has to open just one file to dot-source it, instead of two.

Show 16 quoted lines
>> Source "$(git --exec-path)"/git-sh-i18n instead of simply git-sh-i18n,
>
> That is somewhat strange.  "git-rebase.sh" dot-sources both
> git-sh-setup and git-sh-i18n with just ". $name".  What is so
> special about sh-setup dot-sourcing sh-i18n your patch adds?
>
>> because latter case would fail test t2300-cd-to-toplevel.sh.
>
> What is the real cause of this?
>
> ". git-sh-setup" is supposed to work because we prepend the
> $GIT_EXEC_PATH in "git" itself and git-sh-setup is installed there.
> ". git-sh-i18n" in "git-rebase.sh" works the same way.  If it is
> because is t2300 doing something strange, then we should fix that,
> not adding $(git --exec-path) on the dot-source line to paper things
> over.

This because what t2300 does is strange; I wouldn't call it "wrong" per se, but it is borderline wrong.

Would it allow you to lose the $(git --exec-path) prefix in the new dot-source to have this patch before applying your patch?

-- >8 --
Subject: t2300: run git-sh-setup in an environment that better mimics the real life

When we run scripted Porcelains, "git" potty has set up the $PATH by prepending $GIT_EXEC_PATH, the path given by "git --exec-path=$there $cmd", etc. already. Because of this, scripted Porcelains can dot-source shell script library like git-sh-setup with simple dot without specifying any path.

t2300 however dot-sources git-sh-setup without adjusting $PATH like the real "git" potty does. This has not been a problem so far, but once git-sh-setup wants to rely on the $PATH adjustment, just like any scripted Porcelains already do, it would become one. It cannot for example dot-source another shell library without specifying the full path to it by prefixing $(git --exec-path).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 t/t2300-cd-to-toplevel.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh
index 9965bc5..cccd7d9 100755
--- a/t/t2300-cd-to-toplevel.sh
+++ b/t/t2300-cd-to-toplevel.sh
@@ -8,7 +8,8 @@ test_cd_to_toplevel () {
 	test_expect_success $3 "$2" '
 		(
 			cd '"'$1'"' &&
-			. "$(git --exec-path)"/git-sh-setup &&
+			PATH="$(git --exec-path):$PATH" &&
+			. git-sh-setup &&
 			cd_to_toplevel &&
 			[ "$(pwd -P)" = "$TOPLEVEL" ]
 		)
Previous: Junio C HamanoNext: Vasco Almeida
Message 16 of 50 in “i18n and test updates”
  1. 00/39 i18n and test updatesVasco Almeida, Jun 1, 2016
  2. 01/39 i18n: builtin/remote.c: fix mark for translationVasco Almeida, Jun 1, 2016
  3. 02/39 i18n: advice: mark string about detached head for translationVasco Almeida, Jun 1, 2016
  4. 03/39 i18n: advice: internationalize message for conflictsVasco Almeida, Jun 1, 2016
  5. 04/39 i18n: transport: mark strings for translationVasco Almeida, Jun 1, 2016
  6. 05/39 i18n: sequencer: mark entire sentences for translationVasco Almeida, Jun 1, 2016
  7. 06/39 i18n: sequencer: mark string for translationVasco Almeida, Jun 1, 2016
  8. 07/39 i18n: merge-octopus: mark messages for translationVasco Almeida, Jun 1, 2016
  9. 08/39 merge-octupus: use die shell function from git-sh-setup.shVasco Almeida, Jun 1, 2016
  10. 09/39 i18n: rebase: fix marked string to use eval_gettext variantVasco Almeida, Jun 1, 2016
  11. 10/39 i18n: rebase: mark placeholder for translationVasco Almeida, Jun 1, 2016
  12. 11/39 i18n: bisect: simplify error message for i18nVasco Almeida, Jun 1, 2016
  13. 12/39 t6030: update to use test_i18ncmpVasco Almeida, Jun 1, 2016
  14. 13/39 i18n: git-sh-setup.sh: mark strings for translationVasco Almeida, Jun 1, 2016
  15. Junio C HamanoJun 1, 2016
  16. Junio C HamanoJun 1, 2016
  17. Vasco AlmeidaJun 2, 2016
  18. 14/39 i18n: rebase-interactive: mark strings for translationVasco Almeida, Jun 1, 2016
  19. 15/39 i18n: rebase-interactive: mark here-doc strings for translationVasco Almeida, Jun 1, 2016
  20. 16/39 i18n: rebase-interactive: mark comments of squash for translationVasco Almeida, Jun 1, 2016
  21. 17/39 i18n: setup: mark strings for translationVasco Almeida, Jun 1, 2016
  22. 18/39 tests: use test_i18n* functions to suppress false positivesVasco Almeida, Jun 1, 2016
  23. 19/39 tests: unpack-trees: update to use test_i18n* functionsVasco Almeida, Jun 1, 2016
  24. 20/39 t9003: become resilient to GETTEXT_POISONVasco Almeida, Jun 1, 2016
  25. 21/39 t4153: fix negated test_i18ngrep callVasco Almeida, Jun 1, 2016
  26. 22/39 t5523: use test_i18ngrep for negationVasco Almeida, Jun 1, 2016
  27. 23/39 i18n: bisect: mark strings for translationVasco Almeida, Jun 1, 2016
  28. 24/39 i18n: bisect: enable l10n of bisect terms in messagesVasco Almeida, Jun 1, 2016
  29. Junio C HamanoJun 1, 2016
  30. Vasco AlmeidaJun 2, 2016
  31. Junio C HamanoJun 2, 2016
  32. Vasco AlmeidaJun 3, 2016
  33. 25/39 i18n: transport-helper.c: change N_() call to _()Vasco Almeida, Jun 1, 2016
  34. 26/39 i18n: notes: mark strings for translationVasco Almeida, Jun 1, 2016
  35. 27/39 i18n: notes: mark options for translationVasco Almeida, Jun 1, 2016
  36. 28/39 i18n: config: unfold error messages marked for translationVasco Almeida, Jun 1, 2016
  37. Junio C HamanoJun 1, 2016
  38. Vasco AlmeidaJun 2, 2016
  39. Junio C HamanoJun 2, 2016
  40. 29/39 i18n: merge: mark messages for translationVasco Almeida, Jun 1, 2016
  41. 30/39 i18n: merge: change command option help to lowercaseVasco Almeida, Jun 1, 2016
  42. 31/39 i18n: sequencer: add period to error messageVasco Almeida, Jun 1, 2016
  43. 32/39 i18n: standardise messagesVasco Almeida, Jun 1, 2016
  44. 33/39 i18n: remote: mark URL fallback text for translationVasco Almeida, Jun 1, 2016
  45. 34/39 i18n: remote: allow translations to reorder messageVasco Almeida, Jun 1, 2016
  46. 35/39 i18n: init-db: join message piecesVasco Almeida, Jun 1, 2016
  47. 36/39 i18n: submodule: join strings marked for translationVasco Almeida, Jun 1, 2016
  48. 37/39 i18n: submodule: escape shell variables inside eval_gettextVasco Almeida, Jun 1, 2016
  49. 38/39 i18n: unmark die messages for translationVasco Almeida, Jun 1, 2016
  50. 39/39 i18n: branch: mark comment when editing branch description for translationVasco Almeida, Jun 1, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.