From: Lars Hjemli Date: Sat, 02 Jun 2007 08:39:41 GMT Subject: Re: [PATCH] Let .git/config specify the url for submodules Message-ID: <8c5c35580706020139k3beae8bbj3f51eee0ff5fd30c@mail.gmail.com> In-Reply-To: <20070602074410.GA955MdfPADPa@greensroom.kotnet.org> On 6/2/07, Sven Verdoolaege wrote: > On Sat, Jun 02, 2007 at 09:13:55AM +0200, Lars Hjemli wrote: > > Then Sven suggested to create a submodule section for the url, which would > > allow > > > > $ name=$(GIT_CONFIG=.gitmodules git-config path."$path".submodule) > > $ url=$(GIT_CONFIG=.gitmodules git-config submodule."$name".url) > > > > > > But I don't see an easy way to do the mapping from path to url/submodule > > with: > > > > [submodule "xyzzylib"] > > path=lib > > url=git://xyzzy/lib-1.2.3 > > > > Suggestions? > > I'm not a shell programmer, Me neither ;-) >but it could look something like this > > $ name=$(git config --get-regexp 'submodule\..*\.path' | while read module modulepath; do if test "$modulepath" = "$path"; then echo $module | sed -e 's/^submodule.//' -e 's/.path//'; fi; done) > Ahh, --get-regexp, thanks. Then this actually works: name=$(GIT_CONFIG=.gitmodules git-config --get-regexp 'submodule\..*\.path' 'lib' | sed -e 's/^submodule\.\(.*\)\.path lib$/\1/') But why would we want to design .gitmodules in a way that makes it hard to do the mapping from path to url? -- larsh