From 4f2e94c0f7685f9c58e67b0651147684efb0f57e Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 8 Nov 2007 22:48:49 +0100 Subject: Fix sed string regex escaping in module_name. When escaping a string to be used as a sed regex, it is important to only escape active characters. Escaping other characters is undefined according to POSIX, and in practice leads to issues with extensions such as GNU sed's \+. Signed-off-by: Ralf Wildenhues Signed-off-by: Junio C Hamano --- git-submodule.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'git-submodule.sh') diff --git a/git-submodule.sh b/git-submodule.sh index 673aa27a45..b91d62632c 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -47,7 +47,7 @@ get_repo_base() { module_name() { # Do we have "submodule..path = $1" defined in .gitmodules file? - re=$(printf '%s' "$1" | sed -e 's/\([^a-zA-Z0-9_]\)/\\\1/g') + re=$(printf '%s' "$1" | sed -e 's/[].[^$\\*]/\\&/g') name=$( GIT_CONFIG=.gitmodules \ git config --get-regexp '^submodule\..*\.path$' | sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) -- cgit v1.2.3