Re: [PATCH] git-submodule fixes for call to git config --get-regexp
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 20, 2007, 18:07 UTC
- Message-ID
- <7vsl7jvthk.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <b6ebd0a50707201023h12ed3c61v31ccb2b356c1ee42@mail.gmail.com>
"Chris Larson" <clarson@kergoth.com> writes:
> Two minor git-submodule fixes: > * Escape !'s in the git config --get-regexp, so submodule paths can > contain them.
Show 9 quoted lines
> --- git-submodule.sh.old 2007-07-20 10:13:22.578125000 -0700
> +++ git-submodule.sh 2007-07-20 10:14:56.281250000 -0700
> @@ -46,7 +46,8 @@ get_repo_base() {
> #
> module_name()
> {
> - name=$(GIT_CONFIG=.gitmodules git config --get-regexp
> '^submodule\..*\.path$' "$1" |
> + path=$(echo "$1" | sed -e 's/\!/\\!/g')My first reaction was if it shouldn't be done for only the '!' at the very beginning, to defeat "do_not_match" logic, but it would not hurt if we have extra "\!" in the middle.
Once you introduce that sed to munge the path string, I suspect you would also want and can afford to quote extended regular expression metacharacters as well.
Show 10 quoted lines
> + name=$(GIT_CONFIG=.gitmodules git config --get-regexp > '^submodule\..*\.path$' "^$path$" | > sed -nre 's/^submodule\.(.+)\.path .+$/\1/p') > test -z "$name" && > die "No submodule mapping found in .gitmodules for path '$path'" > > -- > Chris Larson - clarson at kergoth dot com > Dedicated Engineer - MontaVista - clarson at mvista dot com > Core Developer/Architect - TSLib, BitBake, OpenEmbedded, OpenZaurus