[Libreoffice-commits] core.git: config_host.mk.in configure.ac g

Miklos Vajna vmiklos at suse.cz
Sat Feb 9 10:22:07 PST 2013


 config_host.mk.in |    1 +
 configure.ac      |   19 +++++++++++++++++++
 g                 |   16 +++++++++++++++-
 3 files changed, 35 insertions(+), 1 deletion(-)

New commits:
commit 803137f4715ee7ab127a9718ca213db252193398
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Feb 9 19:09:32 2013 +0100

    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

diff --git a/config_host.mk.in b/config_host.mk.in
index fc46a76..4f5d2e4 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 da60c50..723998f 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 0b322ed..f086149 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


More information about the Libreoffice-commits mailing list