[Libreoffice-commits] .: Branch 'feature/submodules' - g

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 8 14:48:36 PDT 2012


 g |   30 ++++++++++++++++++++++++------
 1 file changed, 24 insertions(+), 6 deletions(-)

New commits:
commit ea2a4c1b961c114338439403d4f4de3b62bf6019
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date:   Mon Oct 8 16:46:39 2012 -0500

    try to exploit recent version of git abilities
    
    Change-Id: I41066256a305ba6a376315859ede14fbc2a44eff

diff --git a/g b/g
index 208b359..f7fcc78 100755
--- a/g
+++ b/g
@@ -7,6 +7,8 @@ if [ -n "$g_debug" ] ; then
     set -x
 fi
 
+G_GIT_VERSION=""
+G_SUBMODULE_UPDATE_FLAGS=""
 SUBMODULES_ALL="binfilter dictionaries helpcontent2 translations"
 
 pushd $(dirname $0) > /dev/null
@@ -22,6 +24,22 @@ usage()
     echo " -z restaure the git hooks and others sanity checks"
 }
 
+
+get_git_version_dep()
+{
+    G_GIT_VERSION=$(git --version | cut -f 3 -d' ' 2>/dev/null)
+    if [ -n "${G_GIT_VERSION}" ] ; then
+	if [ "$G_GIT_VERSION" ">" "1.7.5.99" ] ; then
+	    G_SUBMODULE_UPDATE_FLAGS="--force"
+	fi
+    fi
+}
+
+do_submodules_update()
+{
+    git submodule update ${G_SUBMODULE_UPDATE_FLAGS}
+}
+
 refresh_submodule_hooks()
 {
 local repo=$1
@@ -151,7 +169,7 @@ local module
 	fi
     done
     if [ -f .gitmodules ] ; then
-	git submodule update
+	do_submodules_update
 	if [ -n "$branch" ] ; then
 	    git submodules foreach git checkout -b ${branch} HEAD || return $?
 	fi
@@ -172,7 +190,7 @@ do_reset()
 {
     git reset "$@" || return $?
     if [ -f .gitmodules ] ; then
-	git submodule update || return $?
+	do_submodules_update || return $?
     else
 	# now that is the nasty case we moved prior to submodules
 	# delete the submodules left over if any
@@ -214,7 +232,7 @@ fi
 
 get_active_submodules
 get_configured_submodules
-
+get_git_version_dep
 
 
 
@@ -274,12 +292,12 @@ case "$COMMAND" in
 	rc="$?"
 	;;
     clone)
-	do_init_modules && git submodule update
+	do_init_modules && do_submodules_update
 	rc="$?"
 	refresh_all_hooks
         ;;
     fetch)
-	(git fetch "$@" && git submodule foreach git fetch "$@" ) && git submodule update
+	(git fetch "$@" && git submodule foreach git fetch "$@" ) && do_submodules_update
 	rc=$?
 	refresh_all_hooks
 	;;
@@ -289,7 +307,7 @@ case "$COMMAND" in
 	rc=$?
 	;;
     pull)
-	git pull "$@" && git submodule update
+	git pull "$@" && do_submodules_update
 	rc=$?
 	refresh_all_hooks
 	;;


More information about the Libreoffice-commits mailing list