提交 4f2e94c0 编写于 作者: R Ralf Wildenhues 提交者: Junio C Hamano

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: NRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 b5e960b1
......@@ -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' )
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册