X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=git-submodule.sh;h=3adab9363563e80e4ceb2c7fb5c3ab91ac1ef505;hb=0f64a5a3a25c9a161c4e70ae031c885a6284ddb8;hp=5d29f8214950e2aa0f8cf8667302945079d9342a;hpb=9e76d4a8345b247395b902307407ba4eac737524;p=~andy%2Fgit diff --git a/git-submodule.sh b/git-submodule.sh index 5d29f8214..3adab9363 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -122,6 +122,12 @@ 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" 2>/dev/null) @@ -159,9 +165,9 @@ module_clone() 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 @@ -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 @@ -272,7 +275,7 @@ Use -f if you really want to add it." && 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 @@ -459,6 +462,9 @@ cmd_update() --recursive) recursive=1 ;; + --checkout) + update="checkout" + ;; --) shift break @@ -491,7 +497,19 @@ cmd_update() 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 @@ -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 @@ -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 @@ -821,9 +831,9 @@ cmd_summary() { 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|^# $|#|'