{"thread":{"id":"9120","subject":"[PATCH] git-submodule fixes for call to git config --get-regexp","startedAt":"2007-07-20T17:23:05Z","lastAt":"2007-07-20T18:36:43Z","messageCount":3,"participants":["Chris Larson","Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47974","messageId":"b6ebd0a50707201023h12ed3c61v31ccb2b356c1ee42@mail.gmail.com","threadId":"9120","inReplyTo":null,"subject":"[PATCH] git-submodule fixes for call to git config --get-regexp","fromName":"Chris Larson","fromEmail":"clarson@kergoth.com","sentAt":"2007-07-20T17:23:05Z","receivedAt":"2007-07-20T17:23:05Z","isPatch":true,"sender":{"key":"clarson@kergoth.com","avatar":"https://gravatar.com/avatar/8929179d0d33b0477876eaae4d5ca20dc4207c2eb573360adec7d91f63a3bd71?d=mp&s=160"},"body":"Two minor git-submodule fixes:\n* Escape !'s in the git config --get-regexp, so submodule paths can\ncontain them.\n* Be more explicit about the value regex, otherwise things get confused if one\n  submodule name is a prefix of another (since --get-regexp can return\n  multiple values).\n\nSigned-off-by: Chris Larson <clarson@kergoth.com>\n\n--- git-submodule.sh.old\t2007-07-20 10:13:22.578125000 -0700\n+++ git-submodule.sh\t2007-07-20 10:14:56.281250000 -0700\n@@ -46,7 +46,8 @@ get_repo_base() {\n #\n module_name()\n {\n-       name=$(GIT_CONFIG=.gitmodules git config --get-regexp\n'^submodule\\..*\\.path$' \"$1\" |\n+       path=$(echo \"$1\" | sed -e 's/\\!/\\\\!/g')\n+       name=$(GIT_CONFIG=.gitmodules git config --get-regexp\n'^submodule\\..*\\.path$' \"^$path$\" |\n        sed -nre 's/^submodule\\.(.+)\\.path .+$/\\1/p')\n        test -z \"$name\" &&\n        die \"No submodule mapping found in .gitmodules for path '$path'\"\n\n-- \nChris Larson - clarson at kergoth dot com\nDedicated Engineer - MontaVista - clarson at mvista dot com\nCore Developer/Architect - TSLib, BitBake, OpenEmbedded, OpenZaurus\n"},{"id":"47978","messageId":"7vsl7jvthk.fsf@assigned-by-dhcp.cox.net","threadId":"9120","inReplyTo":"b6ebd0a50707201023h12ed3c61v31ccb2b356c1ee42@mail.gmail.com","subject":"Re: [PATCH] git-submodule fixes for call to git config --get-regexp","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-20T18:07:51Z","receivedAt":"2007-07-20T18:07:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Chris Larson\" <clarson@kergoth.com> writes:\n\n> Two minor git-submodule fixes:\n> * Escape !'s in the git config --get-regexp, so submodule paths can\n> contain them.\n\n> --- git-submodule.sh.old\t2007-07-20 10:13:22.578125000 -0700\n> +++ git-submodule.sh\t2007-07-20 10:14:56.281250000 -0700\n> @@ -46,7 +46,8 @@ get_repo_base() {\n> #\n> module_name()\n> {\n> -       name=$(GIT_CONFIG=.gitmodules git config --get-regexp\n> '^submodule\\..*\\.path$' \"$1\" |\n> +       path=$(echo \"$1\" | sed -e 's/\\!/\\\\!/g')\n\nMy first reaction was if it shouldn't be done for only the '!'\nat the very beginning, to defeat \"do_not_match\" logic, but it\nwould not hurt if we have extra \"\\!\" in the middle.\n\nOnce you introduce that sed to munge the path string, I suspect\nyou would also want and can afford to quote extended regular\nexpression metacharacters as well.\n\n> +       name=$(GIT_CONFIG=.gitmodules git config --get-regexp\n> '^submodule\\..*\\.path$' \"^$path$\" |\n>        sed -nre 's/^submodule\\.(.+)\\.path .+$/\\1/p')\n>        test -z \"$name\" &&\n>        die \"No submodule mapping found in .gitmodules for path '$path'\"\n>\n> -- \n> Chris Larson - clarson at kergoth dot com\n> Dedicated Engineer - MontaVista - clarson at mvista dot com\n> Core Developer/Architect - TSLib, BitBake, OpenEmbedded, OpenZaurus\n"},{"id":"47983","messageId":"Pine.LNX.4.64.0707201933360.14781@racer.site","threadId":"9120","inReplyTo":"7vsl7jvthk.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-submodule fixes for call to git config --get-regexp","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-20T18:36:43Z","receivedAt":"2007-07-20T18:36:43Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 20 Jul 2007, Junio C Hamano wrote:\n\n> \"Chris Larson\" <clarson@kergoth.com> writes:\n> \n> > +       name=$(GIT_CONFIG=.gitmodules git config --get-regexp\n> > '^submodule\\..*\\.path$' \"^$path$\" |\n> >        sed -nre 's/^submodule\\.(.+)\\.path .+$/\\1/p')\n\nI wonder why it is a regular expression to begin with, since we seem to \nprefer shell patterns on paths.\n\nHowever, _if_ we already go with regexps, why not just put it into the \n\"sed\" call, which is _already_ there, and leave \"git config\" alone?  IOW \ncall\n\n\tgit config --get-regexp '^submodule\\..*\\.path$' |\n\t\tsed -nre 's/^submodule\\.(.*$path.*)\\.path .+$\\1/p'\n\nHmm?\n\nCiao,\nDscho\n"}]}