From: Junio C Hamano Date: Fri, 6 Jun 2014 18:26:38 +0000 (-0700) Subject: Merge branch 'sk/submodules-absolute-path-on-windows' X-Git-Tag: v2.1.0-rc0~161 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ee8213951a36cefabed7dd653965cffb6aee628e?hp=-c Merge branch 'sk/submodules-absolute-path-on-windows' * sk/submodules-absolute-path-on-windows: Revert "submodules: fix ambiguous absolute paths under Windows" --- ee8213951a36cefabed7dd653965cffb6aee628e diff --combined git-submodule.sh index b55d83ac46,821e6d47cf..e146b833d1 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -9,7 -9,7 +9,7 @@@ USAGE="[--quiet] add [-b ] [-f| or: $dashless [--quiet] status [--cached] [--recursive] [--] [...] or: $dashless [--quiet] init [--] [...] or: $dashless [--quiet] deinit [-f|--force] [--] ... - or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--rebase] [--reference ] [--merge] [--recursive] [--] [...] + or: $dashless [--quiet] update [--init] [--remote] [-N|--no-fetch] [-f|--force] [--checkout|--merge|--rebase] [--reference ] [--recursive] [--] [...] or: $dashless [--quiet] summary [--cached|--files] [--summary-limit ] [commit] [--] [...] or: $dashless [--quiet] foreach [--recursive] or: $dashless [--quiet] sync [--recursive] [--] [...]" @@@ -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 @@@ -751,6 -738,7 +748,6 @@@ --reference) case "$2" in '') usage ;; esac reference="--reference=$2" - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")" shift ;; --reference=*) @@@ -784,6 -772,7 +781,6 @@@ break ;; esac - orig_flags="$orig_flags $(git rev-parse --sq-quote "$1")" shift done @@@ -811,10 -800,6 +808,10 @@@ 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'")" @@@ -912,7 -892,10 +909,7 @@@ 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") @@@ -933,7 -916,7 +930,7 @@@ 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