From: Junio C Hamano Date: Wed, 26 Oct 2011 23:16:32 +0000 (-0700) Subject: Merge branch 'tc/submodule-clone-name-detection' X-Git-Tag: v1.7.8-rc0~9 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0b26d1e8b29a4248d56078318fec6906e3007742?ds=inline;hp=-c Merge branch 'tc/submodule-clone-name-detection' * tc/submodule-clone-name-detection: submodule::module_clone(): silence die() message from module_name() submodule: whitespace fix --- 0b26d1e8b29a4248d56078318fec6906e3007742 diff --combined git-submodule.sh index 928a62f626,5d29f82149..3adab93635 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -104,9 -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" } # @@@ -122,15 -122,9 +122,15 @@@ module_clone( path=$1 url=$2 reference="$3" + quiet= + if test -n "$GIT_QUIET" + then + quiet=-q + fi + gitdir= gitdir_base= - name=$(module_name "$path") + name=$(module_name "$path" 2>/dev/null) base_path=$(dirname "$path") gitdir=$(git rev-parse --git-dir) @@@ -165,9 -159,9 +165,9 @@@ mkdir -p "$gitdir_base" if test -n "$reference" then - git-clone "$reference" -n "$url" "$path" --separate-git-dir "$gitdir" + git-clone $quiet "$reference" -n "$url" "$path" --separate-git-dir "$gitdir" else - git-clone -n "$url" "$path" --separate-git-dir "$gitdir" + git-clone $quiet -n "$url" "$path" --separate-git-dir "$gitdir" fi || die "$(eval_gettext "Clone of '\$url' into submodule path '\$path' failed")" fi @@@ -264,9 -258,12 +264,9 @@@ cmd_add( if test -z "$force" && ! git add --dry-run --ignore-missing "$path" > /dev/null 2>&1 then - ( - eval_gettext "The following path is ignored by one of your .gitignore files: + eval_gettextln "The following path is ignored by one of your .gitignore files: \$path -Use -f if you really want to add it." && - echo - ) >&2 +Use -f if you really want to add it." >&2 exit 1 fi @@@ -275,7 -272,7 +275,7 @@@ then if test -d "$path"/.git -o -f "$path"/.git then - eval_gettext "Adding existing repo at '\$path' to the index"; echo + eval_gettextln "Adding existing repo at '\$path' to the index" else die "$(eval_gettext "'\$path' already exists and is not a valid git repo")" fi @@@ -462,9 -459,6 +462,9 @@@ cmd_update( --recursive) recursive=1 ;; + --checkout) + update="checkout" + ;; --) shift break @@@ -497,19 -491,7 +497,19 @@@ fi name=$(module_name "$path") || exit url=$(git config submodule."$name".url) - update_module=$(git config submodule."$name".update) + if ! test -z "$update" + then + update_module=$update + else + update_module=$(git config submodule."$name".update) + fi + + if test "$update_module" = "none" + then + echo "Skipping submodule '$path'" + continue + fi + if test -z "$url" then # Only mention uninitialized submodules when its @@@ -531,6 -513,11 +531,6 @@@ Maybe you want to use 'update --init'?" die "$(eval_gettext "Unable to find current revision in submodule path '\$path'")" fi - if ! test -z "$update" - then - update_module=$update - fi - if test "$subsha1" != "$sha1" then subforce=$force @@@ -744,7 -731,10 +744,7 @@@ cmd_summary() ;; # removed *) # unexpected type - ( - eval_gettext "unexpected mode \$mod_dst" && - echo - ) >&2 + eval_gettextln "unexpected mode \$mod_dst" >&2 continue ;; esac fi @@@ -831,9 -821,9 +831,9 @@@ done | if test -n "$for_status"; then if [ -n "$files" ]; then - gettext "# Submodules changed but not updated:"; echo + gettextln "# Submodules changed but not updated:" else - gettext "# Submodule changes to be committed:"; echo + gettextln "# Submodule changes to be committed:" fi echo "#" sed -e 's|^|# |' -e 's|^# $|#|'