Merge branch 'sb/submodule-path-misc-bugs' into sb/submodule-init

"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

Any further comments?  Otherwise will merge to 'next'.

* sb/submodule-path-misc-bugs: (600 commits)
  t7407: make expectation as clear as possible
  submodule update: test recursive path reporting from subdirectory
  submodule update: align reporting path for custom command execution
  submodule status: correct path handling in recursive submodules
  submodule update --init: correct path handling in recursive submodules
  submodule foreach: correct path display in recursive submodules
  Git 2.8
  Documentation: fix git-p4 AsciiDoc formatting
  mingw: skip some tests in t9115 due to file name issues
  t1300: fix the new --show-origin tests on Windows
  t1300-repo-config: make it resilient to being run via 'sh -x'
  config --show-origin: report paths with forward slashes
  submodule: fix regression for deinit without submodules
  l10n: pt_PT: Update and add new translations
  l10n: ca.po: update translation
  Git 2.8-rc4
  Documentation: fix broken linkgit to git-config
  Documentation: use ASCII quotation marks in git-p4
  Revert "config.mak.uname: use clang for Mac OS X 10.6"
  git-compat-util: st_add4: work around gcc 4.2.x compiler crash
  ...
This commit is contained in:
Junio C Hamano
2016-04-14 12:47:44 -07:00
461 changed files with 55195 additions and 26723 deletions

View File

@ -413,8 +413,8 @@ cmd_foreach()
die_if_unmatched "$mode"
if test -e "$sm_path"/.git
then
displaypath=$(relative_path "$sm_path")
say "$(eval_gettext "Entering '\$prefix\$displaypath'")"
displaypath=$(relative_path "$prefix$sm_path")
say "$(eval_gettext "Entering '\$displaypath'")"
name=$(git submodule--helper name "$sm_path")
(
prefix="$prefix$sm_path/"
@ -434,7 +434,7 @@ cmd_foreach()
cmd_foreach "--recursive" "$@"
fi
) <&3 3<&- ||
die "$(eval_gettext "Stopping at '\$prefix\$displaypath'; script returned non-zero status.")"
die "$(eval_gettext "Stopping at '\$displaypath'; script returned non-zero status.")"
fi
done
}
@ -473,7 +473,7 @@ cmd_init()
die_if_unmatched "$mode"
name=$(git submodule--helper name "$sm_path") || exit
displaypath=$(relative_path "$sm_path")
displaypath=$(relative_path "$prefix$sm_path")
# Copy url setting when it is not set yet
if test -z "$(git config "submodule.$name.url")"
@ -591,6 +591,24 @@ cmd_deinit()
done
}
is_tip_reachable () (
clear_local_git_env
cd "$1" &&
rev=$(git rev-list -n 1 "$2" --not --all 2>/dev/null) &&
test -z "$rev"
)
fetch_in_submodule () (
clear_local_git_env
cd "$1" &&
case "$2" in
'')
git fetch ;;
*)
git fetch $(get_default_remote) "$2" ;;
esac
)
#
# Update each submodule path to correct revision, using clone and checkout as needed
#
@ -740,10 +758,15 @@ cmd_update()
then
# Run fetch only if $sha1 isn't present or it
# is not reachable from a ref.
(clear_local_git_env; cd "$sm_path" &&
( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
test -z "$rev") || git-fetch)) ||
is_tip_reachable "$sm_path" "$sha1" ||
fetch_in_submodule "$sm_path" ||
die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
# Now we tried the usual fetch, but $sha1 may
# not be reachable from any of the refs
is_tip_reachable "$sm_path" "$sha1" ||
fetch_in_submodule "$sm_path" "$sha1" ||
die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.")"
fi
must_die_on_failure=
@ -767,8 +790,8 @@ cmd_update()
;;
!*)
command="${update_module#!}"
die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$prefix\$sm_path'")"
say_msg="$(eval_gettext "Submodule path '\$prefix\$sm_path': '\$command \$sha1'")"
die_msg="$(eval_gettext "Execution of '\$command \$sha1' failed in submodule path '\$displaypath'")"
say_msg="$(eval_gettext "Submodule path '\$displaypath': '\$command \$sha1'")"
must_die_on_failure=yes
;;
*)
@ -1124,6 +1147,7 @@ cmd_status()
(
prefix="$displaypath/"
clear_local_git_env
wt_prefix=
cd "$sm_path" &&
eval cmd_status
) ||