Git development
 help / color / mirror / Atom feed
* [PATCH] git-sh-setup: Restore sourcability from outside scripts
@ 2016-10-30  2:10 Anders Kaseorg
  2016-10-30 17:55 ` Ævar Arnfjörð Bjarmason
  2016-10-30 22:25 ` Junio C Hamano
  0 siblings, 2 replies; 9+ messages in thread
From: Anders Kaseorg @ 2016-10-30  2:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: 842477, git, Vasco Almeida

v2.10.0-rc0~45^2~2 “i18n: git-sh-setup.sh: mark strings for
translation” broke outside scripts such as guilt that source
git-sh-setup as described in the documentation:

$ . "$(git --exec-path)/git-sh-setup"
sh: 6: .: git-sh-i18n: not found

This also affects contrib/convert-grafts-to-replace-refs.sh and
contrib/rerere-train.sh in tree.  Fix this by using git --exec-path to
find git-sh-i18n.

While we’re here, move the sourcing of git-sh-i18n below the shell
portability fixes.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---

Is this a supported use of git-sh-setup?  Although the documentation is
clear that the end user should not invoke it directly, it seems to imply
that scripts may do this, and in practice it has worked until v2.10.0.

 git-sh-setup.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index a8a4576..240c7eb 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -2,9 +2,6 @@
 # to set up some variables pointing at the normal git directories and
 # a few helper shell functions.
 
-# Source git-sh-i18n for gettext support.
-. git-sh-i18n
-
 # Having this variable in your environment would break scripts because
 # you would cause "cd" to be taken to unexpected places.  If you
 # like CDPATH, define it for your interactive shell sessions without
@@ -46,6 +43,9 @@ git_broken_path_fix () {
 
 # @@BROKEN_PATH_FIX@@
 
+# Source git-sh-i18n for gettext support.
+. "$(git --exec-path)/git-sh-i18n"
+
 die () {
 	die_with_status 1 "$@"
 }
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-10-31  0:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-30  2:10 [PATCH] git-sh-setup: Restore sourcability from outside scripts Anders Kaseorg
2016-10-30 17:55 ` Ævar Arnfjörð Bjarmason
2016-10-30 19:21   ` Anders Kaseorg
2016-10-30 20:09     ` Philip Oakley
2016-10-30 21:12       ` Jeff King
2016-10-30 22:11         ` Ævar Arnfjörð Bjarmason
2016-10-30 22:53           ` Junio C Hamano
2016-10-31  0:30           ` Anders Kaseorg
2016-10-30 22:25 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox