Windows/i18n: rename $path to prevent clashes with $PATH

Environment variables on Windows are case-insensitive. Rename '$path' in
all calls to eval_gettext to $modulepath so that it is not mistakenly
expanded to the value of the $PATH variable.

[jes: this happens to fix t7406/t7407 on Windows]

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Karsten Blees 2012-01-09 19:16:30 +01:00 коммит произвёл Johannes Schindelin
Родитель 6ad9c7d5f8
Коммит 30a615ac66
1 изменённых файлов: 26 добавлений и 26 удалений

Просмотреть файл

@ -105,7 +105,7 @@ module_name()
name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
test -z "$name" && test -z "$name" &&
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$path'")" die "$(modulepath=$path eval_gettext "No submodule mapping found in .gitmodules for path '\$modulepath'")"
echo "$name" echo "$name"
} }
@ -169,7 +169,7 @@ module_clone()
else else
git-clone $quiet -n "$url" "$path" --separate-git-dir "$gitdir" git-clone $quiet -n "$url" "$path" --separate-git-dir "$gitdir"
fi || fi ||
die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")" die "$(modulepath=$path eval_gettext "Clone of '\$url' into submodule path '\$modulepath' failed")"
fi fi
} }
@ -260,13 +260,13 @@ cmd_add()
s|/*$|| s|/*$||
') ')
git ls-files --error-unmatch "$path" > /dev/null 2>&1 && git ls-files --error-unmatch "$path" > /dev/null 2>&1 &&
die "$(eval_gettext "'\$path' already exists in the index")" die "$(modulepath=$path eval_gettext "'\$modulepath' already exists in the index")"
if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1 if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1
then then
cat >&2 <<EOF cat >&2 <<EOF
The following path is ignored by one of your .gitignore files: The following path is ignored by one of your .gitignore files:
$(eval_gettextln $path) $(modulepath=$path eval_gettextln $modulepath)
Use -f if you really want to add it. Use -f if you really want to add it.
EOF EOF
exit 1 exit 1
@ -277,9 +277,9 @@ EOF
then then
if test -d "$path"/.git -o -f "$path"/.git if test -d "$path"/.git -o -f "$path"/.git
then then
eval_gettextln "Adding existing repo at '\$path' to the index" modulepath=$path eval_gettextln "Adding existing repo at '\$modulepath' to the index"
else else
die "$(eval_gettext "'\$path' already exists and is not a valid git repo")" die "$(modulepath=$path eval_gettext "'\$modulepath' already exists and is not a valid git repo")"
fi fi
else else
@ -293,17 +293,17 @@ EOF
'') git checkout -f -q ;; '') git checkout -f -q ;;
?*) git checkout -f -q -B "$branch" "origin/$branch" ;; ?*) git checkout -f -q -B "$branch" "origin/$branch" ;;
esac esac
) || die "$(eval_gettext "Unable to checkout submodule '\$path'")" ) || die "$(modulepath=$path eval_gettext "Unable to checkout submodule '\$modulepath'")"
fi fi
git config submodule."$path".url "$realrepo" git config submodule."$path".url "$realrepo"
git add $force "$path" || git add $force "$path" ||
die "$(eval_gettext "Failed to add submodule '\$path'")" die "$(modulepath=$path eval_gettext "Failed to add submodule '\$modulepath'")"
git config -f .gitmodules submodule."$path".path "$path" && git config -f .gitmodules submodule."$path".path "$path" &&
git config -f .gitmodules submodule."$path".url "$repo" && git config -f .gitmodules submodule."$path".url "$repo" &&
git add --force .gitmodules || git add --force .gitmodules ||
die "$(eval_gettext "Failed to register submodule '\$path'")" die "$(modulepath=$path eval_gettext "Failed to register submodule '\$modulepath'")"
} }
# #
@ -345,7 +345,7 @@ cmd_foreach()
do do
if test -e "$path"/.git if test -e "$path"/.git
then then
say "$(eval_gettext "Entering '\$prefix\$path'")" say "$(modulepath=$path eval_gettext "Entering '\$prefix\$modulepath'")"
name=$(module_name "$path") name=$(module_name "$path")
( (
prefix="$prefix$path/" prefix="$prefix$path/"
@ -357,7 +357,7 @@ cmd_foreach()
cmd_foreach "--recursive" "$@" cmd_foreach "--recursive" "$@"
fi fi
) <&3 3<&- || ) <&3 3<&- ||
die "$(eval_gettext "Stopping at '\$path'; script returned non-zero status.")" die "$(modulepath=$path eval_gettext "Stopping at '\$modulepath'; script returned non-zero status.")"
fi fi
done done
} }
@ -399,7 +399,7 @@ cmd_init()
then then
url=$(git config -f .gitmodules submodule."$name".url) url=$(git config -f .gitmodules submodule."$name".url)
test -z "$url" && test -z "$url" &&
die "$(eval_gettext "No url found for submodule path '\$path' in .gitmodules")" die "$(modulepath=$path eval_gettext "No url found for submodule path '\$modulepath' in .gitmodules")"
# Possibly a url relative to parent # Possibly a url relative to parent
case "$url" in case "$url" in
@ -408,7 +408,7 @@ cmd_init()
;; ;;
esac esac
git config submodule."$name".url "$url" || git config submodule."$name".url "$url" ||
die "$(eval_gettext "Failed to register url for submodule path '\$path'")" die "$(modulepath=$path eval_gettext "Failed to register url for submodule path '\$modulepath'")"
fi fi
# Copy "update" setting when it is not set yet # Copy "update" setting when it is not set yet
@ -416,9 +416,9 @@ cmd_init()
test -z "$upd" || test -z "$upd" ||
test -n "$(git config submodule."$name".update)" || test -n "$(git config submodule."$name".update)" ||
git config submodule."$name".update "$upd" || git config submodule."$name".update "$upd" ||
die "$(eval_gettext "Failed to register update mode for submodule path '\$path'")" die "$(modulepath=$path eval_gettext "Failed to register update mode for submodule path '\$modulepath'")"
say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$path'")" say "$(modulepath=$path eval_gettext "Submodule '\$name' (\$url) registered for path '\$modulepath'")"
done done
} }
@ -517,7 +517,7 @@ cmd_update()
# Only mention uninitialized submodules when its # Only mention uninitialized submodules when its
# path have been specified # path have been specified
test "$#" != "0" && test "$#" != "0" &&
say "$(eval_gettext "Submodule path '\$path' not initialized say "$(modulepath=$path eval_gettext "Submodule path '\$modulepath' not initialized
Maybe you want to use 'update --init'?")" Maybe you want to use 'update --init'?")"
continue continue
fi fi
@ -530,7 +530,7 @@ Maybe you want to use 'update --init'?")"
else else
subsha1=$(clear_local_git_env; cd "$path" && subsha1=$(clear_local_git_env; cd "$path" &&
git rev-parse --verify HEAD) || git rev-parse --verify HEAD) ||
die "$(eval_gettext "Unable to find current revision in submodule path '\$path'")" die "$(modulepath=$path eval_gettext "Unable to find current revision in submodule path '\$modulepath'")"
fi fi
if test "$subsha1" != "$sha1" if test "$subsha1" != "$sha1"
@ -549,7 +549,7 @@ Maybe you want to use 'update --init'?")"
(clear_local_git_env; cd "$path" && (clear_local_git_env; cd "$path" &&
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) && ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
test -z "$rev") || git-fetch)) || test -z "$rev") || git-fetch)) ||
die "$(eval_gettext "Unable to fetch in submodule path '\$path'")" die "$(modulepath=$path eval_gettext "Unable to fetch in submodule path '\$modulepath'")"
fi fi
# Is this something we just cloned? # Is this something we just cloned?
@ -563,20 +563,20 @@ Maybe you want to use 'update --init'?")"
case "$update_module" in case "$update_module" in
rebase) rebase)
command="git rebase" command="git rebase"
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$path'")" die_msg="$(modulepath=$path eval_gettext "Unable to rebase '\$sha1' in submodule path '\$modulepath'")"
say_msg="$(eval_gettext "Submodule path '\$path': rebased into '\$sha1'")" say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': rebased into '\$sha1'")"
must_die_on_failure=yes must_die_on_failure=yes
;; ;;
merge) merge)
command="git merge" command="git merge"
die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$path'")" die_msg="$(modulepath=$path eval_gettext "Unable to merge '\$sha1' in submodule path '\$modulepath'")"
say_msg="$(eval_gettext "Submodule path '\$path': merged in '\$sha1'")" say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': merged in '\$sha1'")"
must_die_on_failure=yes must_die_on_failure=yes
;; ;;
*) *)
command="git checkout $subforce -q" command="git checkout $subforce -q"
die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$path'")" die_msg="$(modulepath=$path eval_gettext "Unable to checkout '\$sha1' in submodule path '\$modulepath'")"
say_msg="$(eval_gettext "Submodule path '\$path': checked out '\$sha1'")" say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': checked out '\$sha1'")"
;; ;;
esac esac
@ -598,7 +598,7 @@ Maybe you want to use 'update --init'?")"
res=$? res=$?
if test $res -gt 0 if test $res -gt 0
then then
die_msg="$(eval_gettext "Failed to recurse into submodule path '\$path'")" die_msg="$(modulepath=$path eval_gettext "Failed to recurse into submodule path '\$modulepath'")"
if test $res -eq 1 if test $res -eq 1
then then
err="${err};$die_msg" err="${err};$die_msg"
@ -925,7 +925,7 @@ cmd_status()
cd "$path" && cd "$path" &&
eval cmd_status "$orig_args" eval cmd_status "$orig_args"
) || ) ||
die "$(eval_gettext "Failed to recurse into submodule path '\$path'")" die "$(modulepath=$path eval_gettext "Failed to recurse into submodule path '\$modulepath'")"
fi fi
done done
} }