summaryrefslogtreecommitdiff
path: root/g
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-02-09 19:09:32 +0100
committerMiklos Vajna <vmiklos@suse.cz>2013-02-09 19:21:53 +0100
commit803137f4715ee7ab127a9718ca213db252193398 (patch)
treef60e81e1c47f0440d858eb9e0377286711ae56b4 /g
parent857a39265452c23d4769e6d729ae4c30e44b2973 (diff)
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
Diffstat (limited to 'g')
-rwxr-xr-xg16
1 files changed, 15 insertions, 1 deletions
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