Code

contrib/completion: "local var=()" is misinterpreted as func-decl by zsh
[git.git] / git-submodule.sh
index 928a62f626fe7ff1db8239713d94ff9aa25158eb..9bb2e13e929c824a75c648966aaaa61672b9c445 100755 (executable)
@@ -104,9 +104,9 @@ module_name()
        re=$(printf '%s\n' "$1" | sed -e 's/[].[^$\\*]/\\&/g')
        name=$( git config -f .gitmodules --get-regexp '^submodule\..*\.path$' |
                sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' )
-       test -z "$name" &&
-       die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$path'")"
-       echo "$name"
+       test -z "$name" &&
+       die "$(eval_gettext "No submodule mapping found in .gitmodules for path '\$path'")"
+       echo "$name"
 }
 
 #
@@ -130,7 +130,8 @@ module_clone()
 
        gitdir=
        gitdir_base=
-       name=$(module_name "$path")
+       name=$(module_name "$path" 2>/dev/null)
+       test -n "$name" || name="$path"
        base_path=$(dirname "$path")
 
        gitdir=$(git rev-parse --git-dir)