commit:     eb4c42b20e78f3577ea26a028ff92393e2c4a2ff
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 25 13:22:17 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jan 25 13:24:04 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb4c42b2

git-r3.eclass: Escape all weird chars in submodule names, #606950

 eclass/git-r3.eclass | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/eclass/git-r3.eclass b/eclass/git-r3.eclass
index f76f1a7..d105e50 100644
--- a/eclass/git-r3.eclass
+++ b/eclass/git-r3.eclass
@@ -447,10 +447,11 @@ _git-r3_set_submodules() {
                        submodule."${subname}".update)
                [[ ${upd} == none ]] && continue
 
-               # https://github.com/git/git/blob/master/refs.c#L39
-               # for now, we just filter /. because of #572312
-               local enc_subname=${subname//\/.//_}
-               [[ ${enc_subname} == .* ]] && enc_subname=_${enc_subname#.}
+               # https://github.com/git/git/blob/master/refs.c#L31
+               # we are more restrictive than git itself but that should not
+               # cause any issues, #572312, #606950
+               # TODO: check escaped names for collisions
+               local enc_subname=${subname//[^a-zA-Z0-9-]/_}
 
                submodules+=(
                        "${enc_subname}"

Reply via email to