All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Johannes Sixt" <j.sixt@viscovery.net>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 4/6] i18n win32: add git-stash eval_gettext variable prefix
Date: Wed, 25 May 2011 23:19:52 +0000	[thread overview]
Message-ID: <1306365594-22061-5-git-send-email-avarab@gmail.com> (raw)
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

  parent reply	other threads:[~2011-05-25 23:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 23:19 [PATCH 0/6] i18n: Windows shellscript support Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` [PATCH 1/6] i18n win32: add git-am eval_gettext variable prefix Ævar Arnfjörð Bjarmason
2011-05-26  6:34   ` Johannes Sixt
2011-05-26 14:13     ` Junio C Hamano
2011-05-26 14:59       ` Johannes Sixt
2011-05-26 15:16         ` Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` [PATCH 2/6] i18n win32: add git-bisect " Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` [PATCH 3/6] i18n win32: add git-pull " Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` Ævar Arnfjörð Bjarmason [this message]
2011-05-25 23:19 ` [PATCH 5/6] i18n win32: add git-submodule " Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` [PATCH 6/6] i18n win32: add test " Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306365594-22061-5-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j.sixt@viscovery.net \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.