Skip to content

Commit 30a615a

Browse files
kbleesdscho
authored andcommitted
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>
1 parent 6ad9c7d commit 30a615a

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

git-submodule.sh

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ module_name()
105105
name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
106106
sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
107107
test -z "$name" &&
108-
die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$path'")"
108+
die "$(modulepath=$path eval_gettext "No submodule mapping found in .gitmodules for path '\$modulepath'")"
109109
echo "$name"
110110
}
111111

@@ -169,7 +169,7 @@ module_clone()
169169
else
170170
git-clone $quiet -n "$url" "$path" --separate-git-dir "$gitdir"
171171
fi ||
172-
die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")"
172+
die "$(modulepath=$path eval_gettext "Clone of '\$url' into submodule path '\$modulepath' failed")"
173173
fi
174174
}
175175

@@ -260,13 +260,13 @@ cmd_add()
260260
s|/*$||
261261
')
262262
git ls-files --error-unmatch "$path" > /dev/null 2>&1 &&
263-
die "$(eval_gettext "'\$path' already exists in the index")"
263+
die "$(modulepath=$path eval_gettext "'\$modulepath' already exists in the index")"
264264

265265
if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1
266266
then
267267
cat >&2 <<EOF
268268
The following path is ignored by one of your .gitignore files:
269-
$(eval_gettextln $path)
269+
$(modulepath=$path eval_gettextln $modulepath)
270270
Use -f if you really want to add it.
271271
EOF
272272
exit 1
@@ -277,9 +277,9 @@ EOF
277277
then
278278
if test -d "$path"/.git -o -f "$path"/.git
279279
then
280-
eval_gettextln "Adding existing repo at '\$path' to the index"
280+
modulepath=$path eval_gettextln "Adding existing repo at '\$modulepath' to the index"
281281
else
282-
die "$(eval_gettext "'\$path' already exists and is not a valid git repo")"
282+
die "$(modulepath=$path eval_gettext "'\$modulepath' already exists and is not a valid git repo")"
283283
fi
284284

285285
else
@@ -293,17 +293,17 @@ EOF
293293
'') git checkout -f -q ;;
294294
?*) git checkout -f -q -B "$branch" "origin/$branch" ;;
295295
esac
296-
) || die "$(eval_gettext "Unable to checkout submodule '\$path'")"
296+
) || die "$(modulepath=$path eval_gettext "Unable to checkout submodule '\$modulepath'")"
297297
fi
298298
git config submodule."$path".url "$realrepo"
299299

300300
git add $force "$path" ||
301-
die "$(eval_gettext "Failed to add submodule '\$path'")"
301+
die "$(modulepath=$path eval_gettext "Failed to add submodule '\$modulepath'")"
302302

303303
git config -f .gitmodules submodule."$path".path "$path" &&
304304
git config -f .gitmodules submodule."$path".url "$repo" &&
305305
git add --force .gitmodules ||
306-
die "$(eval_gettext "Failed to register submodule '\$path'")"
306+
die "$(modulepath=$path eval_gettext "Failed to register submodule '\$modulepath'")"
307307
}
308308

309309
#
@@ -345,7 +345,7 @@ cmd_foreach()
345345
do
346346
if test -e "$path"/.git
347347
then
348-
say "$(eval_gettext "Entering '\$prefix\$path'")"
348+
say "$(modulepath=$path eval_gettext "Entering '\$prefix\$modulepath'")"
349349
name=$(module_name "$path")
350350
(
351351
prefix="$prefix$path/"
@@ -357,7 +357,7 @@ cmd_foreach()
357357
cmd_foreach "--recursive" "$@"
358358
fi
359359
) <&3 3<&- ||
360-
die "$(eval_gettext "Stopping at '\$path'; script returned non-zero status.")"
360+
die "$(modulepath=$path eval_gettext "Stopping at '\$modulepath'; script returned non-zero status.")"
361361
fi
362362
done
363363
}
@@ -399,7 +399,7 @@ cmd_init()
399399
then
400400
url=$(git config -f .gitmodules submodule."$name".url)
401401
test -z "$url" &&
402-
die "$(eval_gettext "No url found for submodule path '\$path' in .gitmodules")"
402+
die "$(modulepath=$path eval_gettext "No url found for submodule path '\$modulepath' in .gitmodules")"
403403

404404
# Possibly a url relative to parent
405405
case "$url" in
@@ -408,17 +408,17 @@ cmd_init()
408408
;;
409409
esac
410410
git config submodule."$name".url "$url" ||
411-
die "$(eval_gettext "Failed to register url for submodule path '\$path'")"
411+
die "$(modulepath=$path eval_gettext "Failed to register url for submodule path '\$modulepath'")"
412412
fi
413413

414414
# Copy "update" setting when it is not set yet
415415
upd="$(git config -f .gitmodules submodule."$name".update)"
416416
test -z "$upd" ||
417417
test -n "$(git config submodule."$name".update)" ||
418418
git config submodule."$name".update "$upd" ||
419-
die "$(eval_gettext "Failed to register update mode for submodule path '\$path'")"
419+
die "$(modulepath=$path eval_gettext "Failed to register update mode for submodule path '\$modulepath'")"
420420

421-
say "$(eval_gettext "Submodule '\$name' (\$url) registered for path '\$path'")"
421+
say "$(modulepath=$path eval_gettext "Submodule '\$name' (\$url) registered for path '\$modulepath'")"
422422
done
423423
}
424424

@@ -517,7 +517,7 @@ cmd_update()
517517
# Only mention uninitialized submodules when its
518518
# path have been specified
519519
test "$#" != "0" &&
520-
say "$(eval_gettext "Submodule path '\$path' not initialized
520+
say "$(modulepath=$path eval_gettext "Submodule path '\$modulepath' not initialized
521521
Maybe you want to use 'update --init'?")"
522522
continue
523523
fi
@@ -530,7 +530,7 @@ Maybe you want to use 'update --init'?")"
530530
else
531531
subsha1=$(clear_local_git_env; cd "$path" &&
532532
git rev-parse --verify HEAD) ||
533-
die "$(eval_gettext "Unable to find current revision in submodule path '\$path'")"
533+
die "$(modulepath=$path eval_gettext "Unable to find current revision in submodule path '\$modulepath'")"
534534
fi
535535

536536
if test "$subsha1" != "$sha1"
@@ -549,7 +549,7 @@ Maybe you want to use 'update --init'?")"
549549
(clear_local_git_env; cd "$path" &&
550550
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
551551
test -z "$rev") || git-fetch)) ||
552-
die "$(eval_gettext "Unable to fetch in submodule path '\$path'")"
552+
die "$(modulepath=$path eval_gettext "Unable to fetch in submodule path '\$modulepath'")"
553553
fi
554554

555555
# Is this something we just cloned?
@@ -563,20 +563,20 @@ Maybe you want to use 'update --init'?")"
563563
case "$update_module" in
564564
rebase)
565565
command="git rebase"
566-
die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$path'")"
567-
say_msg="$(eval_gettext "Submodule path '\$path': rebased into '\$sha1'")"
566+
die_msg="$(modulepath=$path eval_gettext "Unable to rebase '\$sha1' in submodule path '\$modulepath'")"
567+
say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': rebased into '\$sha1'")"
568568
must_die_on_failure=yes
569569
;;
570570
merge)
571571
command="git merge"
572-
die_msg="$(eval_gettext "Unable to merge '\$sha1' in submodule path '\$path'")"
573-
say_msg="$(eval_gettext "Submodule path '\$path': merged in '\$sha1'")"
572+
die_msg="$(modulepath=$path eval_gettext "Unable to merge '\$sha1' in submodule path '\$modulepath'")"
573+
say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': merged in '\$sha1'")"
574574
must_die_on_failure=yes
575575
;;
576576
*)
577577
command="git checkout $subforce -q"
578-
die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$path'")"
579-
say_msg="$(eval_gettext "Submodule path '\$path': checked out '\$sha1'")"
578+
die_msg="$(modulepath=$path eval_gettext "Unable to checkout '\$sha1' in submodule path '\$modulepath'")"
579+
say_msg="$(modulepath=$path eval_gettext "Submodule path '\$modulepath': checked out '\$sha1'")"
580580
;;
581581
esac
582582

@@ -598,7 +598,7 @@ Maybe you want to use 'update --init'?")"
598598
res=$?
599599
if test $res -gt 0
600600
then
601-
die_msg="$(eval_gettext "Failed to recurse into submodule path '\$path'")"
601+
die_msg="$(modulepath=$path eval_gettext "Failed to recurse into submodule path '\$modulepath'")"
602602
if test $res -eq 1
603603
then
604604
err="${err};$die_msg"
@@ -925,7 +925,7 @@ cmd_status()
925925
cd "$path" &&
926926
eval cmd_status "$orig_args"
927927
) ||
928-
die "$(eval_gettext "Failed to recurse into submodule path '\$path'")"
928+
die "$(modulepath=$path eval_gettext "Failed to recurse into submodule path '\$modulepath'")"
929929
fi
930930
done
931931
}

0 commit comments

Comments
 (0)