summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b5e960b)
raw | patch | inline | side by side (parent: b5e960b)
author | Ralf Wildenhues <Ralf.Wildenhues@gmx.de> | |
Thu, 8 Nov 2007 21:48:49 +0000 (22:48 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 8 Nov 2007 23:56:22 +0000 (15:56 -0800) |
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>
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>
git-submodule.sh | patch | blob | history |
diff --git a/git-submodule.sh b/git-submodule.sh
index 673aa27a452b11af62d89986bf21c8a4f10e0c41..b91d62632c2eecf701a473dfaf90874a19f90f98 100755 (executable)
--- a/git-submodule.sh
+++ b/git-submodule.sh
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' )