Re: bootstrap: improve gnulib git update logic

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: bootstrap: improve gnulib git update logic

mmuetzel
Am 18.08.2020 um 04:09 schrieb "Kai Torben Ohlhus:
> When GNULIB_SRCDIR is set, this addition should probably work as well.
> Looking at it, maybe it can be fixed by extending your code section [2] by "git fetch":
>
>   if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
>      && ! git_modules_config submodule.gnulib.url >/dev/null; then
>     (cd "$GNULIB_SRCDIR" && git fetch && git checkout
> "$GNULIB_REVISION") || cleanup_gnulib
>   fi

I didn't receive the original message. Thanks, Kai, for the pointers.

What about only fetching from the remote repository if the selected revision doesn't exist locally?

diff --git "a/build-aux/bootstrap" "b/build-aux/bootstrap"
index 8f76d6962..6dfbd907d 100644
--- "a/build-aux/bootstrap"
+++ "b/build-aux/bootstrap"
@@ -704,6 +704,8 @@ if $use_gnulib; then

   if test -d "$GNULIB_SRCDIR"/.git && test -n "$GNULIB_REVISION" \
      && ! git_modules_config submodule.gnulib.url >/dev/null; then
+    (cd "$GNULIB_SRCDIR" && ! git cat-file commit "$GNULIB_REVISION" \
+     && git fetch)
     (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || cleanup_gnulib
   fi


Markus