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

[PATCH 4/6] i18n win32: add git-stash eval_gettext variable prefix

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 25, 2011, 23:19 UTC
Message-ID
<1306365594-22061-5-git-send-email-avarab@gmail.com>
In-Reply-To
<1306365594-22061-1-git-send-email-avarab@gmail.com>

Change the eval_gettext() invocations to use the GIT_I18N_VARIABLE_ prefix for variables used in eval_gettext. On Windows environment variables are case insensitive, so e.g. $PATH clashes with $path. By using a sufficiently unique prefix we work around that issue.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-stash.sh |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index c72ba49..e925e27 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -153,6 +153,7 @@ save_stash () {
 			;;
 		-*)
 			option="$1"
+			GIT_I18N_VARIABLE_option=$option
 			# TRANSLATORS: $option is an invalid option, like
 			# `--blah-blah'. The 7 spaces at the beginning of the
 			# second line correspond to "error: ". So you should line
@@ -163,8 +164,8 @@ save_stash () {
 			#    $ git stash save --blah-blah 2>&1 | head -n 2
 			#    error: unknown option for 'stash save': --blah-blah
 			#           To provide a message, use git stash save -- '--blah-blah'
-			eval_gettext "$("error: unknown option for 'stash save': \$option
-       To provide a message, use git stash save -- '\$option'")"; echo
+			eval_gettext "$("error: unknown option for 'stash save': \$GIT_I18N_VARIABLE_option
+       To provide a message, use git stash save -- '\$GIT_I18N_VARIABLE_option'")"; echo
 			usage
 			;;
 		*)
@@ -306,13 +307,14 @@ parse_flags_and_rev()
 			:
 		;;
 		*)
-			die "$(eval_gettext "Too many revisions specified: \$REV")"
+			GIT_I18N_VARIABLE_REV=$REV
+			die "$(eval_gettext "Too many revisions specified: \$GIT_I18N_VARIABLE_REV")"
 		;;
 	esac
 
 	REV=$(git rev-parse --quiet --symbolic --verify $1 2>/dev/null) || {
-		reference="$1"
-		die "$(eval_gettext "\$reference is not valid reference")"
+		GIT_I18N_VARIABLE_reference="$1"
+		die "$(eval_gettext "\$GIT_I18N_VARIABLE_reference is not valid reference")"
 	}
 
 	i_commit=$(git rev-parse --quiet --verify $REV^2 2>/dev/null) &&
@@ -336,8 +338,8 @@ is_stash_like()
 
 assert_stash_like() {
 	is_stash_like "$@" || {
-		args="$*"
-		die "$(eval_gettext "'\$args' is not a stash-like commit")"
+		GIT_I18N_VARIABLE_args="$*"
+		die "$(eval_gettext "'\$GIT_I18N_VARIABLE_args' is not a stash-like commit")"
 	}
 }
 
@@ -347,8 +349,8 @@ is_stash_ref() {
 
 assert_stash_ref() {
 	is_stash_ref "$@" || {
-		args="$*"
-		die "$(eval_gettext "'\$args' is not a stash reference")"
+		GIT_I18N_VARIABLE_args="$*"
+		die "$(eval_gettext "'\$GIT_I18N_VARIABLE_args' is not a stash reference")"
 	}
 }
 
@@ -429,9 +431,11 @@ pop_stash() {
 drop_stash () {
 	assert_stash_ref "$@"
 
+	GIT_I18N_VARIABLE_REV=$REV
+	GIT_I18N_VARIABLE_s=$s
 	git reflog delete --updateref --rewrite "${REV}" &&
-		say "$(eval_gettext "Dropped \${REV} (\$s)")" ||
-		die "$(eval_gettext "\${REV}: Could not drop stash entry")"
+		say "$(eval_gettext "Dropped \$GIT_I18N_VARIABLE_REV (\$GIT_I18N_VARIABLE_s)")" ||
+		die "$(eval_gettext "\$GIT_I18N_VARIABLE_REV: Could not drop stash entry")"
 
 	# clear_stash if we just dropped the last stash entry
 	git rev-parse --verify "$ref_stash@{0}" > /dev/null 2>&1 || clear_stash
-- 
1.7.5.1
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 9 of 11 in “i18n: Windows shellscript support”
  1. 0/6 i18n: Windows shellscript supportÆvar Arnfjörð Bjarmason, May 25, 2011
  2. 1/6 i18n win32: add git-am eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011
  3. Johannes SixtMay 26, 2011
  4. Junio C HamanoMay 26, 2011
  5. Johannes SixtMay 26, 2011
  6. Ævar Arnfjörð BjarmasonMay 26, 2011
  7. 2/6 i18n win32: add git-bisect eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011
  8. 3/6 i18n win32: add git-pull eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011
  9. 4/6 i18n win32: add git-stash eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011
  10. 5/6 i18n win32: add git-submodule eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011
  11. 6/6 i18n win32: add test eval_gettext variable prefixÆvar Arnfjörð Bjarmason, May 25, 2011

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.