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 2/6] i18n win32: add git-bisect eval_gettext variable prefix
Date: Wed, 25 May 2011 23:19:50 +0000	[thread overview]
Message-ID: <1306365594-22061-3-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-bisect.sh |   39 ++++++++++++++++++++++++++-------------
 1 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 375b187..6a6ea43 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -116,8 +116,11 @@ bisect_start() {
 		;;
 	    *)
 		rev=$(git rev-parse -q --verify "$arg^{commit}") || {
-		    test $has_double_dash -eq 1 &&
-		        die "$(eval_gettext "'\$arg' does not appear to be a valid revision")"
+		    if test $has_double_dash -eq 1
+		    then
+		        $GIT_I18N_VARIABLE_arg=$arg
+		        die "$(eval_gettext "'\$GIT_I18N_VARIABLE_arg' does not appear to be a valid revision")"
+		    fi
 		    break
 		}
 		case $bad_seen in
@@ -162,7 +165,8 @@ bisect_write() {
 	case "$state" in
 		bad)		tag="$state" ;;
 		good|skip)	tag="$state"-"$rev" ;;
-		*)		die "$(eval_gettext "Bad bisect_write argument: \$state")" ;;
+		*)		GIT_I18N_VARIABLE_state=$state
+				die "$(eval_gettext "Bad bisect_write argument: \$GIT_I18N_VARIABLE_state")" ;;
 	esac
 	git update-ref "refs/bisect/$tag" "$rev" || exit
 	echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
@@ -190,7 +194,8 @@ bisect_skip() {
 	do
 	    case "$arg" in
             *..*)
-                revs=$(git rev-list "$arg") || die "$(eval_gettext "Bad rev input: \$arg")" ;;
+				GIT_I18N_VARIABLE_arg=$arg
+                revs=$(git rev-list "$arg") || die "$(eval_gettext "Bad rev input: \$GIT_I18N_VARIABLE_arg")" ;;
             *)
                 revs=$(git rev-parse --sq-quote "$arg") ;;
 	    esac
@@ -215,8 +220,9 @@ bisect_state() {
 		eval=''
 		for rev in "$@"
 		do
+			GIT_I18N_VARIABLE_rev=$rev
 			sha=$(git rev-parse --verify "$rev^{commit}") ||
-				die "$(eval_gettext "Bad rev input: \$rev")"
+				die "$(eval_gettext "Bad rev input: \$GIT_I18N_VARIABLE_rev")"
 			eval="$eval bisect_write '$state' '$sha'; "
 		done
 		eval "$eval"
@@ -333,8 +339,8 @@ bisect_reset() {
 	case "$#" in
 	0) branch=$(cat "$GIT_DIR/BISECT_START") ;;
 	1) git rev-parse --quiet --verify "$1^{commit}" > /dev/null || {
-	       invalid="$1"
-	       die "$(eval_gettext "'\$invalid' is not a valid commit")"
+	       GIT_I18N_VARIABLE_invalid="$1"
+	       die "$(eval_gettext "'\$GIT_I18N_VARIABLE_invalid' is not a valid commit")"
 	   }
 	   branch="$1" ;;
 	*)
@@ -343,7 +349,8 @@ bisect_reset() {
 	if git checkout "$branch" -- ; then
 		bisect_clean_state
 	else
-		die "$(eval_gettext "Could not check out original HEAD '\$branch'.
+		GIT_I18N_VARIABLE_branch=$branch
+		die "$(eval_gettext "Could not check out original HEAD '\$GIT_I18N_VARIABLE_branch'.
 Try 'git bisect reset <commit>'.")"
 	fi
 }
@@ -369,7 +376,10 @@ bisect_clean_state() {
 bisect_replay () {
 	file="$1"
 	test "$#" -eq 1 || die "$(gettext "No logfile given")"
-	test -r "$file" || die "$(eval_gettext "cannot read \$file for replaying")"
+	test -r "$file" || {
+		GIT_I18N_VARIABLE_file=$file
+		die "$(eval_gettext "cannot read \$GIT_I18N_VARIABLE_file for replaying")"
+	}
 	bisect_reset
 	while read git bisect command rev
 	do
@@ -396,16 +406,17 @@ bisect_run () {
 
     while true
     do
-      command="$@"
-      eval_gettext "running \$command"; echo
+      GIT_I18N_VARIABLE_command="$@"
+      eval_gettext "running \$GIT_I18N_VARIABLE_command"; echo
       "$@"
       res=$?
 
       # Check for really bad run error.
       if [ $res -lt 0 -o $res -ge 128 ]; then
 	  (
+	    GIT_I18N_VARIABLE_res=$res
 	    eval_gettext "bisect run failed:
-exit code \$res from '\$command' is < 0 or >= 128" &&
+exit code \$GIT_I18N_VARIABLE_res from '\$GIT_I18N_VARIABLE_command' is < 0 or >= 128" &&
 	    echo
 	  ) >&2
 	  exit $res
@@ -438,8 +449,10 @@ exit code \$res from '\$command' is < 0 or >= 128" &&
 
       if [ $res -ne 0 ]; then
 	  (
+	      GIT_I18N_VARIABLE_state=$state
+	      GIT_I18N_VARIABLE_res=$res
 	      eval_gettext "bisect run failed:
-'bisect_state \$state' exited with error code \$res" &&
+'bisect_state \$GIT_I18N_VARIABLE_state' exited with error code \$GIT_I18N_VARIABLE_res" &&
 	      echo
 	  ) >&2
 	  exit $res
-- 
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 ` Ævar Arnfjörð Bjarmason [this message]
2011-05-25 23:19 ` [PATCH 3/6] i18n win32: add git-pull " Ævar Arnfjörð Bjarmason
2011-05-25 23:19 ` [PATCH 4/6] i18n win32: add git-stash " Ævar Arnfjörð Bjarmason
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-3-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.