Merge branch 'tc/submodule-clone-name-detection'
authorJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2011 23:16:32 +0000 (16:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 26 Oct 2011 23:16:32 +0000 (16:16 -0700)
* tc/submodule-clone-name-detection:
submodule::module_clone(): silence die() message from module_name()
submodule: whitespace fix

1  2 
git-submodule.sh
diff --combined git-submodule.sh
index 928a62f626fe7ff1db8239713d94ff9aa25158eb,5d29f8214950e2aa0f8cf8667302945079d9342a..3adab9363563e80e4ceb2c7fb5c3ab91ac1ef505
@@@ -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)
                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
  
        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
                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
        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|^# $|#|'