{"thread":{"id":"31640","subject":"[PATCH] submodule: configure submodule.<name>.path on add and init","startedAt":"2012-09-24T19:30:40Z","lastAt":"2012-09-25T20:58:43Z","messageCount":5,"participants":["Orgad Shaneh","Jens Lehmann","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199848","messageId":"1348515040-19986-1-git-send-email-orgads@gmail.com","threadId":"31640","inReplyTo":null,"subject":"[PATCH] submodule: configure submodule.<name>.path on add and init","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2012-09-24T19:30:40Z","receivedAt":"2012-09-24T19:30:40Z","isPatch":true,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"In order to read diff options for a submodule, its path must be configured\n---\n git-submodule.sh |    2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 3e2045e..f97bb62 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -359,6 +359,7 @@ Use -f if you really want to add it.\" >&2\n \t\t\tesac\n \t\t) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n \tfi\n+\tgit config submodule.\"$sm_path\".path \"$sm_path\"\n \tgit config submodule.\"$sm_path\".url \"$realrepo\"\n \n \tgit add $force \"$sm_path\" ||\n@@ -476,6 +477,7 @@ cmd_init()\n \t\t\t\turl=$(resolve_relative_url \"$url\") || exit\n \t\t\t\t;;\n \t\t\tesac\n+\t\t\tgit config submodule.\"$name\".path \"$name\" ||\n \t\t\tgit config submodule.\"$name\".url \"$url\" ||\n \t\t\tdie \"$(eval_gettext \"Failed to register url for submodule path '\\$sm_path'\")\"\n \n-- \n1.7.10.4\n"},{"id":"199850","messageId":"CAGHpTB+6AggmTWchcSEFDW1kmv=-Ej4u3RFuiik5KspR=D0ASQ@mail.gmail.com","threadId":"31640","inReplyTo":"1348515040-19986-1-git-send-email-orgads@gmail.com","subject":"Re: [PATCH] submodule: configure submodule.<name>.path on add and init","fromName":"Orgad Shaneh","fromEmail":"orgads@gmail.com","sentAt":"2012-09-24T19:32:54Z","receivedAt":"2012-09-24T19:32:54Z","isPatch":true,"sender":{"key":"orgads@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1246544?v=4"},"body":"On Mon, Sep 24, 2012 at 9:30 PM, Orgad Shaneh <orgads@gmail.com> wrote:\n> In order to read diff options for a submodule, its path must be configured\n> ---\n>  git-submodule.sh |    2 ++\n>  1 file changed, 2 insertions(+)\n>\n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 3e2045e..f97bb62 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -359,6 +359,7 @@ Use -f if you really want to add it.\" >&2\n>                         esac\n>                 ) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n>         fi\n> +       git config submodule.\"$sm_path\".path \"$sm_path\"\n>         git config submodule.\"$sm_path\".url \"$realrepo\"\n>\n>         git add $force \"$sm_path\" ||\n> @@ -476,6 +477,7 @@ cmd_init()\n>                                 url=$(resolve_relative_url \"$url\") || exit\n>                                 ;;\n>                         esac\n> +                       git config submodule.\"$name\".path \"$name\" ||\n>                         git config submodule.\"$name\".url \"$url\" ||\n>                         die \"$(eval_gettext \"Failed to register url for submodule path '\\$sm_path'\")\"\n>\n> --\n> 1.7.10.4\n>\n\nOops, || should have been &&\n\n- Orgad\n"},{"id":"199854","messageId":"5060BB3D.9010609@web.de","threadId":"31640","inReplyTo":"1348515040-19986-1-git-send-email-orgads@gmail.com","subject":"Re: [PATCH] submodule: configure submodule.<name>.path on add and init","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-09-24T19:57:49Z","receivedAt":"2012-09-24T19:57:49Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 24.09.2012 21:30, schrieb Orgad Shaneh:\n> In order to read diff options for a submodule, its path must be configured\n> ---\n>  git-submodule.sh |    2 ++\n>  1 file changed, 2 insertions(+)\n> \n> diff --git a/git-submodule.sh b/git-submodule.sh\n> index 3e2045e..f97bb62 100755\n> --- a/git-submodule.sh\n> +++ b/git-submodule.sh\n> @@ -359,6 +359,7 @@ Use -f if you really want to add it.\" >&2\n>  \t\t\tesac\n>  \t\t) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n>  \tfi\n> +\tgit config submodule.\"$sm_path\".path \"$sm_path\"\n>  \tgit config submodule.\"$sm_path\".url \"$realrepo\"\n>  \n>  \tgit add $force \"$sm_path\" ||\n> @@ -476,6 +477,7 @@ cmd_init()\n>  \t\t\t\turl=$(resolve_relative_url \"$url\") || exit\n>  \t\t\t\t;;\n>  \t\t\tesac\n> +\t\t\tgit config submodule.\"$name\".path \"$name\" ||\n>  \t\t\tgit config submodule.\"$name\".url \"$url\" ||\n>  \t\t\tdie \"$(eval_gettext \"Failed to register url for submodule path '\\$sm_path'\")\"\n\nNack. The path must only be configured in .gitmodules or we'll\nnever be able to rename the submodule directory.\n"},{"id":"199860","messageId":"7vmx0fxicf.fsf@alter.siamese.dyndns.org","threadId":"31640","inReplyTo":"5060BB3D.9010609@web.de","subject":"Re: [PATCH] submodule: configure submodule.<name>.path on add and init","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-24T20:43:12Z","receivedAt":"2012-09-24T20:43:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jens Lehmann <Jens.Lehmann@web.de> writes:\n\n> Am 24.09.2012 21:30, schrieb Orgad Shaneh:\n>> In order to read diff options for a submodule, its path must be configured\n>> ---\n>>  git-submodule.sh |    2 ++\n>>  1 file changed, 2 insertions(+)\n>> \n>> diff --git a/git-submodule.sh b/git-submodule.sh\n>> index 3e2045e..f97bb62 100755\n>> --- a/git-submodule.sh\n>> +++ b/git-submodule.sh\n>> @@ -359,6 +359,7 @@ Use -f if you really want to add it.\" >&2\n>>  \t\t\tesac\n>>  \t\t) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n>>  \tfi\n>> +\tgit config submodule.\"$sm_path\".path \"$sm_path\"\n>>  \tgit config submodule.\"$sm_path\".url \"$realrepo\"\n>>  \n>>  \tgit add $force \"$sm_path\" ||\n>> @@ -476,6 +477,7 @@ cmd_init()\n>>  \t\t\t\turl=$(resolve_relative_url \"$url\") || exit\n>>  \t\t\t\t;;\n>>  \t\t\tesac\n>> +\t\t\tgit config submodule.\"$name\".path \"$name\" ||\n>>  \t\t\tgit config submodule.\"$name\".url \"$url\" ||\n>>  \t\t\tdie \"$(eval_gettext \"Failed to register url for submodule path '\\$sm_path'\")\"\n>\n> Nack. The path must only be configured in .gitmodules or we'll\n> never be able to rename the submodule directory.\n\nThat sounds sensible on the surface, and the rejection of this is\nprobably the right thing to do, but then how would the name/path\nmapping work without .gitmodules?  Historically, you did not have to\nhave a .gitmodules in-tree at all in order to use submodules\nlocally, but if discovery of submodule.$name.ignore depends on\nhaving the in-tree .gitmodules file, that sounds like a minor\nregression to me.\n"},{"id":"199908","messageId":"50621B03.6010805@web.de","threadId":"31640","inReplyTo":"7vmx0fxicf.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] submodule: configure submodule.<name>.path on add and init","fromName":"Jens Lehmann","fromEmail":"jens.lehmann@web.de","sentAt":"2012-09-25T20:58:43Z","receivedAt":"2012-09-25T20:58:43Z","isPatch":true,"sender":{"key":"jens.lehmann@web.de","avatar":"https://avatars.githubusercontent.com/u/135220?v=4"},"body":"Am 24.09.2012 22:43, schrieb Junio C Hamano:\n> Jens Lehmann <Jens.Lehmann@web.de> writes:\n> \n>> Am 24.09.2012 21:30, schrieb Orgad Shaneh:\n>>> In order to read diff options for a submodule, its path must be configured\n>>> ---\n>>>  git-submodule.sh |    2 ++\n>>>  1 file changed, 2 insertions(+)\n>>>\n>>> diff --git a/git-submodule.sh b/git-submodule.sh\n>>> index 3e2045e..f97bb62 100755\n>>> --- a/git-submodule.sh\n>>> +++ b/git-submodule.sh\n>>> @@ -359,6 +359,7 @@ Use -f if you really want to add it.\" >&2\n>>>  \t\t\tesac\n>>>  \t\t) || die \"$(eval_gettext \"Unable to checkout submodule '\\$sm_path'\")\"\n>>>  \tfi\n>>> +\tgit config submodule.\"$sm_path\".path \"$sm_path\"\n>>>  \tgit config submodule.\"$sm_path\".url \"$realrepo\"\n>>>  \n>>>  \tgit add $force \"$sm_path\" ||\n>>> @@ -476,6 +477,7 @@ cmd_init()\n>>>  \t\t\t\turl=$(resolve_relative_url \"$url\") || exit\n>>>  \t\t\t\t;;\n>>>  \t\t\tesac\n>>> +\t\t\tgit config submodule.\"$name\".path \"$name\" ||\n>>>  \t\t\tgit config submodule.\"$name\".url \"$url\" ||\n>>>  \t\t\tdie \"$(eval_gettext \"Failed to register url for submodule path '\\$sm_path'\")\"\n>>\n>> Nack. The path must only be configured in .gitmodules or we'll\n>> never be able to rename the submodule directory.\n> \n> That sounds sensible on the surface, and the rejection of this is\n> probably the right thing to do, but then how would the name/path\n> mapping work without .gitmodules?  Historically, you did not have to\n> have a .gitmodules in-tree at all in order to use submodules\n> locally, but if discovery of submodule.$name.ignore depends on\n> having the in-tree .gitmodules file, that sounds like a minor\n> regression to me.\n\nAFAIK the name/path mapping was added to enable moving submodules\naround in the work tree without having to adapt its $GITDIR/config\nentries every time you checkout a commit where the submodule's work\ntree is moved someplace else inside the superproject's work tree.\nNowadays we also use that to consistently store the submodule's\n.git directory under \"modules/<name>\" inside the superproject's\n.git directory no matter what its current path is.\n\nYou still don't need a .gitmodules file to use submodules locally,\nbut then moving around these submodules is not - and has never\nbeen - that easy. To use the ignore setting without a .gitmodules\nfile you'll just have to set both submodule.$name.ignore and\nsubmodule.$name.path (to provide the mapping, in most cases path\nand name will simply be the same) in your $GITDIR/config and\neverything will work just fine.\n"}]}