Merge branch 'sb/submodule-embed-gitdir'

A new submodule helper "git submodule embedgitdirs" to make it
easier to move embedded .git/ directory for submodules in a
superproject to .git/modules/ (and point the latter with the former
that is turned into a "gitdir:" file) has been added.

* sb/submodule-embed-gitdir:
  worktree: initialize return value for submodule_uses_worktrees
  submodule: add absorb-git-dir function
  move connect_work_tree_and_git_dir to dir.h
  worktree: check if a submodule uses worktrees
  test-lib-functions.sh: teach test_commit -C <dir>
  submodule helper: support super prefix
  submodule: use absolute path for computing relative path connecting
This commit is contained in:
Junio C Hamano
2017-01-10 15:24:27 -08:00
12 changed files with 399 additions and 43 deletions

View File

@ -157,16 +157,21 @@ debug () {
GIT_TEST_GDB=1 "$@"
}
# Call test_commit with the arguments "<message> [<file> [<contents> [<tag>]]]"
# Call test_commit with the arguments
# [-C <directory>] <message> [<file> [<contents> [<tag>]]]"
#
# This will commit a file with the given contents and the given commit
# message, and tag the resulting commit with the given tag name.
#
# <file>, <contents>, and <tag> all default to <message>.
#
# If the first argument is "-C", the second argument is used as a path for
# the git invocations.
test_commit () {
notick= &&
signoff= &&
indir= &&
while test $# != 0
do
case "$1" in
@ -176,21 +181,26 @@ test_commit () {
--signoff)
signoff="$1"
;;
-C)
indir="$2"
shift
;;
*)
break
;;
esac
shift
done &&
indir=${indir:+"$indir"/} &&
file=${2:-"$1.t"} &&
echo "${3-$1}" > "$file" &&
git add "$file" &&
echo "${3-$1}" > "$indir$file" &&
git ${indir:+ -C "$indir"} add "$file" &&
if test -z "$notick"
then
test_tick
fi &&
git commit $signoff -m "$1" &&
git tag "${4:-$1}"
git ${indir:+ -C "$indir"} commit $signoff -m "$1" &&
git ${indir:+ -C "$indir"} tag "${4:-$1}"
}
# Call test_merge with the arguments "<message> <commit>", where <commit>