Kaydet (Commit) 803137f4 authored tarafından Miklos Vajna's avatar Miklos Vajna

configure: add --with-referenced-git option

This is similar to --with-linked-git, but:

1) It uses git submodule update --reference, so it works with submodules.

2) The created repo is a true git repo, except that its object database
reuses the referenced repo's objects, so it's a real speedup when e.g.
translations are enabled.

I intentionally didn't just fixed --with-linked-git, to make it clear
this is more like git clone --reference, not git-new-workdir.

Change-Id: I7c9584bce3670fd1e175b90aded2435cfe78056d
üst 857a3926
......@@ -189,6 +189,7 @@ export GCONF_LIBS=$(gb_SPACE)@GCONF_LIBS@
export GIO_CFLAGS=$(gb_SPACE)@GIO_CFLAGS@
export GIO_LIBS=$(gb_SPACE)@GIO_LIBS@
export GIT_LINK_SRC=@GIT_LINK_SRC@
export GIT_REFERENCE_SRC=@GIT_REFERENCE_SRC@
export GIT_NEEDED_SUBMODULES=@GIT_NEEDED_SUBMODULES@
export GNOMEVFS_CFLAGS=$(gb_SPACE)@GNOMEVFS_CFLAGS@
export GNOMEVFS_LIBS=$(gb_SPACE)@GNOMEVFS_LIBS@
......
......@@ -1202,6 +1202,14 @@ AC_ARG_WITH(linked-git,
GIT_LINK_SRC=$withval ,
)
AC_ARG_WITH(referenced-git,
AS_HELP_STRING([--with-referenced-git=<OTHER_CHECKOUT_DIR>],
[Specify another checkout directory to reference. This makes use of
git submodule update --reference, and saves a lot of diskspace
when having multiple trees side-by-side.]),
GIT_REFERENCE_SRC=$withval ,
)
AC_ARG_WITH(vba-package-format,
AS_HELP_STRING([--with-vba-package-format],
[Specify package format for vba compatibility api. Specifying "builtin"
......@@ -11915,6 +11923,17 @@ if test -n "${GIT_LINK_SRC}"; then
fi
AC_SUBST(GIT_LINK_SRC)
dnl git submodule update --reference
dnl ===================================================================
if test -n "${GIT_REFERENCE_SRC}"; then
for repo in ${GIT_NEEDED_SUBMODULES}; do
if ! test -d "${GIT_REFERENCE_SRC}"/${repo}; then
AC_MSG_ERROR([referenced git: required repository does not exist: ${GIT_REFERENCE_SRC}/${repo}])
fi
done
fi
AC_SUBST(GIT_REFERENCE_SRC)
dnl branding
dnl ===================================================================
AC_MSG_CHECKING([for alternative branding images directory])
......
......@@ -146,6 +146,14 @@ get_configured_submodules()
fi
}
get_git_reference()
{
REFERENCED_GIT=""
if [ -f config_host.mk ]; then
REFERENCED_GIT=$(cat config_host.mk | grep GIT_REFERENCE_SRC | sed -e "s/.*=//")
fi
}
do_shortcut_update()
{
local module
......@@ -246,6 +254,11 @@ local configured
git submodule init $module || return $?
fi
done
if [ -n "$REFERENCED_GIT" ] ; then
for module in $SUBMODULES_CONFIGURED ; do
git submodule update --reference $REFERENCED_GIT/.git/modules/$module $module || return $?
done
fi
return 0
}
......@@ -263,6 +276,7 @@ fi
get_active_submodules
get_configured_submodules
get_git_reference
......@@ -319,7 +333,7 @@ case "$COMMAND" in
do_checkout "$@"
;;
clone)
do_init_modules && git submodule update && refresh_all_hooks
do_init_modules && refresh_all_hooks
;;
fetch)
(git fetch "$@" && git submodule foreach git fetch "$@" ) && git submodule update
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment