X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-submodule.sh;h=3320998c76ba72094755ec60369a6266751889ff;hb=e4cd6c7a20bfc776086817671d58e09060a8079a;hp=1f0cb99dcb09cd0db0f34ed9f70467cee0fe922b;hpb=0707a9d6f200bbafc02d13dd7f2c12bb795999f6;p=git.git diff --git a/git-submodule.sh b/git-submodule.sh index 1f0cb99dc..3320998c7 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -46,8 +46,11 @@ get_repo_base() { # module_name() { - name=$(GIT_CONFIG=.gitmodules git config --get-regexp '^submodule\..*\.path$' "$1" | - sed -nre 's/^submodule\.(.+)\.path .+$/\1/p') + # Do we have "submodule..path = $1" defined in .gitmodules file? + re=$(printf '%s' "$1" | sed -e 's/\([^a-zA-Z0-9_]\)/\\\1/g') + name=$( GIT_CONFIG=.gitmodules \ + git config --get-regexp '^submodule\..*\.path$' | + sed -n -e 's|^submodule\.\(.*\)\.path '"$re"'$|\1|p' ) test -z "$name" && die "No submodule mapping found in .gitmodules for path '$path'" echo "$name" @@ -233,7 +236,6 @@ modules_list() say "-$sha1 $path" continue; fi - revname=$(unset GIT_DIR && cd "$path" && git describe --tags $sha1) set_name_rev "$path" "$sha1" if git diff-files --quiet -- "$path" then @@ -311,7 +313,7 @@ case "$add,$init,$update,$status,$cached" in ,,1,,) modules_update "$@" ;; -,,,1,*) +,,,*,*) modules_list "$@" ;; *)