Subject: Re: [PATCH] git-submodule.sh: Don't use $path variable in eval_gettext string

From: Ramsay Jones <[email-masked]>
Date: Wed, 18 Apr 2012 21:06:04 +0100

Jens Lehmann wrote:
>> Signed-off-by: Ramsay Jones <[email-masked]>
>> ---
> 
> To me it makes sense to rename the problematic $path variable to
> get rid of this problem.

>>  git-submodule.sh |  161 +++++++++++++++++++++++++++---------------------------
>>  1 file changed, 82 insertions(+), 79 deletions(-)
>>
>> diff --git a/git-submodule.sh b/git-submodule.sh
>> index 3d94a14..64a70d6 100755
>> --- a/git-submodule.sh
>> +++ b/git-submodule.sh
>> @@ -101,11 +101,12 @@ module_list()
>>  module_name()
>>  {
>>  	# Do we have "submodule.<something>.path = $1" defined in .gitmodules file?
>> +	sm_path="$1"
>>  	re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
>>  	name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
>>  		sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
>>  	test -z "$name" &&
>> -	die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$path'")"
>> +	die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$sm_path'")"
>>  	echo "$name"
>>  }
> 
> And as an extra this part fixes the bug that the die won't print the
> submodule path in case of an error as to do that it would have had
> to use $1 here ;-)

Yes, I noted that this was an independent fix when I first sent this to the
list (as an RFC) in the v1.7.8 rc time frame.

I had intended to either add a separate patch to fix this, or note it in the commit
message, but I obviously forgot.

[Junio, which alternative would you prefer?]

Thanks!

ATB,
Ramsay Jones