Subject: Re: [PATCH] submodule: configure submodule.<name>.path on add and init

From: Junio C Hamano <[email-masked]>
Date: Mon, 24 Sep 2012 13:43:12 -0700

Jens Lehmann <[email-masked]> writes:

> Am 24.09.2012 21:30, schrieb Orgad Shaneh:
>> In order to read diff options for a submodule, its path must be configured
>> ---
>>  git-submodule.sh |    2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/git-submodule.sh b/git-submodule.sh
>> index 3e2045e..f97bb62 100755
>> --- a/git-submodule.sh
>> +++ b/git-submodule.sh
>> @@ -359,6 +359,7 @@ Use -f if you really want to add it." >&2
>>  			esac
>>  		) || die "$(eval_gettext "Unable to checkout submodule '\$sm_path'")"
>>  	fi
>> +	git config submodule."$sm_path".path "$sm_path"
>>  	git config submodule."$sm_path".url "$realrepo"
>>  
>>  	git add $force "$sm_path" ||
>> @@ -476,6 +477,7 @@ cmd_init()
>>  				url=$(resolve_relative_url "$url") || exit
>>  				;;
>>  			esac
>> +			git config submodule."$name".path "$name" ||
>>  			git config submodule."$name".url "$url" ||
>>  			die "$(eval_gettext "Failed to register url for submodule path '\$sm_path'")"
>
> Nack. The path must only be configured in .gitmodules or we'll
> never be able to rename the submodule directory.

That sounds sensible on the surface, and the rejection of this is
probably the right thing to do, but then how would the name/path
mapping work without .gitmodules?  Historically, you did not have to
have a .gitmodules in-tree at all in order to use submodules
locally, but if discovery of submodule.$name.ignore depends on
having the in-tree .gitmodules file, that sounds like a minor
regression to me.