# HG changeset patch # User Paolo Bonzini # Date 1222937870 -7200 # Node ID 9a78b559898ae42caebcecb2463c501700e46fb0 # Parent 18c6bf992870ce361cdfba8f93619f7767a210b6 have bootstrap initialize a `gnulib' submodule in a git checkout 2008-10-02 Paolo Bonzini * build-aux/bootstrap: Recognize `gnulib' being a submodule in a git repository, and initialize/update it accordingly. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-10-02 Paolo Bonzini + + * build-aux/bootstrap: Recognize `gnulib' being a submodule in a + git repository, and initialize/update it accordingly. + 2008-10-02 Jim Meyering fts.c: sync with similar code from coreutils' remove.c diff --git a/build-aux/bootstrap b/build-aux/bootstrap --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -224,11 +224,20 @@ exit $status } +git_modules_config () { + GIT_CONFIG_LOCAL=.gitmodules git config "$@" +} + # Get gnulib files. case ${GNULIB_SRCDIR--} in -) - if [ ! -d gnulib ]; then + if git_modules_config submodule.gnulib.url >/dev/null; then + echo "$0: getting gnulib files..." + git submodule init || exit $? + git submodule update || exit $? + + elif [ ! -d gnulib ]; then echo "$0: getting gnulib files..." trap cleanup_gnulib 1 2 13 15 @@ -239,6 +248,20 @@ trap - 1 2 13 15 fi GNULIB_SRCDIR=gnulib + ;; +*) + # Redirect the gnulib submodule to the directory on the command line + # if possible. + if test -d "$GNULIB_SRCDIR"/.git && \ + git_modules_config submodule.gnulib.url >/dev/null; then + git submodule init + GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd` + git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR + echo "$0: getting gnulib files..." + git submodule update || exit $? + GNULIB_SRCDIR=gnulib + fi + ;; esac gnulib_tool=$GNULIB_SRCDIR/gnulib-tool