summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac19
-rwxr-xr-xg16
3 files changed, 35 insertions, 1 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index fc46a761115c..4f5d2e45301f 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -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@
diff --git a/configure.ac b/configure.ac
index da60c50c5d90..723998ff5129 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/g b/g
index 0b322edbe4e1..f086149345bd 100755
--- a/g
+++ b/g
@@ -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