git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Apr 18, 2012, 20:06 UTC
Message-ID
<4F8F1EAC.5040704@ramsay1.demon.co.uk>
In-Reply-To
<4F8EA009.5080405@web.de>
Jens Lehmann wrote:
Show 5 quoted lines
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>> ---
> 
> To me it makes sense to rename the problematic $path variable to
> get rid of this problem.
Show 24 quoted lines
>>  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

Previous: Johannes SixtNext: Junio C Hamano
Message 4 of 6 in “git-submodule.sh: Don't use $path variable in eval_gettext string”
  1. git-submodule.sh: Don't use $path variable in eval_gettext stringRamsay Jones, Apr 17, 2012
  2. Jens LehmannApr 18, 2012
  3. Johannes SixtApr 18, 2012
  4. Ramsay JonesApr 18, 2012
  5. Junio C HamanoApr 18, 2012
  6. Ramsay JonesApr 24, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.