Merge branch 'sk/submodules-absolute-path-on-windows'
authorJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:26:38 +0000 (11:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Jun 2014 18:26:38 +0000 (11:26 -0700)
* sk/submodules-absolute-path-on-windows:
Revert "submodules: fix ambiguous absolute paths under Windows"

1  2 
git-submodule.sh
diff --combined git-submodule.sh
index b55d83ac46a96ba15fb7ac8cb43b8c279b40d119,821e6d47cf3b970be93fd8153c6a79ca5e76a0cd..e146b833d163ab58984fec3d6fb9f45b148e0171
@@@ -9,7 -9,7 +9,7 @@@ USAGE="[--quiet] add [-b <branch>] [-f|
     or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
     or: $dashless [--quiet] init [--] [<path>...]
     or: $dashless [--quiet] deinit [-f|--force] [--] <path>...
 -   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
 +   or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--reference <repository>] [--recursive] [--] [<path>...]
     or: $dashless [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
     or: $dashless [--quiet] foreach [--recursive] <command>
     or: $dashless [--quiet] sync [--recursive] [--] [<path>...]"
@@@ -156,7 -156,7 +156,7 @@@ module_list(
                git ls-files -z --error-unmatch --stage -- "$@" ||
                echo "unmatched pathspec exists"
        ) |
 -      perl -e '
 +      @@PERL@@ -e '
        my %unmerged = ();
        my ($null_sha1) = ("0" x 40);
        my @out = ();
@@@ -241,12 -241,6 +241,12 @@@ module_name(
  #
  # Clone a submodule
  #
 +# $1 = submodule path
 +# $2 = submodule name
 +# $3 = URL to clone
 +# $4 = reference repository to reuse (empty for independent)
 +# $5 = depth argument for shallow clones (empty for deep)
 +#
  # Prior to calling, cmd_update checks that a possibly existing
  # path is not a git repository.
  # Likewise, cmd_add checks that path does not exist at all,
@@@ -291,9 -285,6 +291,6 @@@ module_clone(
        # resolve any symlinks that might be present in $PWD
        a=$(cd_to_toplevel && cd "$gitdir" && pwd)/
        b=$(cd_to_toplevel && cd "$sm_path" && pwd)/
-       # normalize Windows-style absolute paths to POSIX-style absolute paths
-       case $a in [a-zA-Z]:/*) a=/${a%%:*}${a#*:} ;; esac
-       case $b in [a-zA-Z]:/*) b=/${b%%:*}${b#*:} ;; esac
        # Remove all common leading directories after a sanity check
        if test "${a#$b}" != "$a" || test "${b#$a}" != "$b"; then
                die "$(eval_gettext "Gitdir '\$a' is part of the submodule path '\$b' or vice versa")"
@@@ -551,12 -542,7 +548,12 @@@ cmd_foreach(
                                sm_path=$(relative_path "$sm_path") &&
                                # we make $path available to scripts ...
                                path=$sm_path &&
 -                              eval "$@" &&
 +                              if test $# -eq 1
 +                              then
 +                                      eval "$1"
 +                              else
 +                                      "$@"
 +                              fi &&
                                if test -n "$recursive"
                                then
                                        cmd_foreach "--recursive" "$@"
@@@ -628,7 -614,7 +625,7 @@@ cmd_init(
                   test -z "$(git config submodule."$name".update)"
                then
                        case "$upd" in
 -                      rebase | merge | none)
 +                      checkout | rebase | merge | none)
                                ;; # known modes of updating
                        *)
                                echo >&2 "warning: unknown update mode '$upd' suggested for submodule '$name'"
@@@ -727,6 -713,7 +724,6 @@@ cmd_deinit(
  cmd_update()
  {
        # parse $args after "submodule ... update".
 -      orig_flags=
        while test $# -ne 0
        do
                case "$1" in
                --reference)
                        case "$2" in '') usage ;; esac
                        reference="--reference=$2"
 -                      orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                        shift
                        ;;
                --reference=*)
                        break
                        ;;
                esac
 -              orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")"
                shift
        done
  
                        update_module=$update
                else
                        update_module=$(git config submodule."$name".update)
 +                      if test -z "$update_module"
 +                      then
 +                              update_module="checkout"
 +                      fi
                fi
  
                displaypath=$(relative_path "$prefix$sm_path")
@@@ -883,16 -868,11 +880,16 @@@ Maybe you want to use 'update --init'?"
                        case ";$cloned_modules;" in
                        *";$name;"*)
                                # then there is no local change to integrate
 -                              update_module= ;;
 +                              update_module=checkout ;;
                        esac
  
                        must_die_on_failure=
                        case "$update_module" in
 +                      checkout)
 +                              command="git checkout $subforce -q"
 +                              die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
 +                              say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
 +                              ;;
                        rebase)
                                command="git rebase"
                                die_msg="$(eval_gettext "Unable to rebase '\$sha1' in submodule path '\$displaypath'")"
                                must_die_on_failure=yes
                                ;;
                        *)
 -                              command="git checkout $subforce -q"
 -                              die_msg="$(eval_gettext "Unable to checkout '\$sha1' in submodule path '\$displaypath'")"
 -                              say_msg="$(eval_gettext "Submodule path '\$displaypath': checked out '\$sha1'")"
 -                              ;;
 +                              die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
                        esac
  
                        if (clear_local_git_env; cd "$sm_path" && $command "$sha1")
                                prefix="$prefix$sm_path/"
                                clear_local_git_env
                                cd "$sm_path" &&
 -                              eval cmd_update "$orig_flags"
 +                              eval cmd_update
                        )
                        res=$?
                        if test $res -gt 0