summaryrefslogtreecommitdiff
path: root/git-submodule.sh
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2007-11-08 21:48:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-11-08 23:56:22 (GMT)
commit4f2e94c0f7685f9c58e67b0651147684efb0f57e (patch)
tree2006490e960d390a0014c112970eea633d0c8bb2 /git-submodule.sh
parentb5e960b108b48b3ebd92a3c1b22b13a9edd127dc (diff)
downloadgit-4f2e94c0f7685f9c58e67b0651147684efb0f57e.zip
git-4f2e94c0f7685f9c58e67b0651147684efb0f57e.tar.gz
git-4f2e94c0f7685f9c58e67b0651147684efb0f57e.tar.bz2
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 <Ralf.Wildenhues@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-submodule.sh')
-rwxr-xr-xgit-submodule.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/git-submodule.sh b/git-submodule.sh
index 673aa27..b91d626 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -47,7 +47,7 @@ get_repo_base() {
module_name()
{
# Do we have "submodule.<something>.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' )