]> Savannah Git Hosting - gnulib.git/commitdiff
bootstrap: Support checking out a recent GNULIB_REVISION.
authorBruno Haible <bruno@clisp.org>
Sat, 27 Apr 2024 17:08:06 +0000 (19:08 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 27 Apr 2024 17:08:06 +0000 (19:08 +0200)
Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00462.html>.

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If the
'git checkout' command fails, fetch the newer commits and then retry it.
* build-aux/bootstrap: Regenerated.

ChangeLog
build-aux/bootstrap
top/bootstrap-funclib.sh

index b1c986eaf31d4f802b58398bacd119261af6edb7..dacf6892b13ef0d1949df1bacc10d41ed36be054 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-04-27  Bruno Haible  <bruno@clisp.org>
+
+       bootstrap: Support checking out a recent GNULIB_REVISION.
+       Reported by Markus Mützel <markus.muetzel@gmx.de> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00462.html>.
+       * top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If the
+       'git checkout' command fails, fetch the newer commits and then retry it.
+       * build-aux/bootstrap: Regenerated.
+
 2024-04-27  Bruno Haible  <bruno@clisp.org>
 
        ctime, localtime, tzset, wcsftime: Fix env access (regr. 2024-02-09).
index 20913180a640e388153a994408bc249b59baae7c..8d0b97d43602bf215119ad42689ade069db5b8a2 100755 (executable)
@@ -37,7 +37,7 @@ medir=`dirname "$me"`
 
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-04-13.15; # UTC
+scriptlibversion=2024-04-27.17; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -499,7 +499,17 @@ prepare_GNULIB_SRCDIR ()
       || die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified," \
              "but does not contain gnulib-tool"
     if test -n "$GNULIB_REVISION" && $use_git; then
-      (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || exit $?
+      # The 'git checkout "$GNULIB_REVISION"' command succeeds if the
+      # GNULIB_REVISION is a commit hash that exists locally, or if it is
+      # branch name that can be fetched from origin. It fails, however,
+      # if the GNULIB_REVISION is a commit hash that only exists in origin.
+      # In this case, we need a 'git fetch' and then retry
+      # 'git checkout "$GNULIB_REVISION"'.
+      (cd "$GNULIB_SRCDIR" \
+       && { git checkout "$GNULIB_REVISION" 2>/dev/null \
+            || { git fetch origin && git checkout "$GNULIB_REVISION"; }
+          }
+      ) || exit $?
     fi
   else
     if ! $use_git; then
index 7511d62d9b853f8b6ef155510ab99e37fbae960d..620006d320b4dcde43f4224112736ede08e39a9b 100644 (file)
@@ -1,6 +1,6 @@
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-04-13.15; # UTC
+scriptlibversion=2024-04-27.17; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -462,7 +462,17 @@ prepare_GNULIB_SRCDIR ()
       || die "Error: --gnulib-srcdir or \$GNULIB_SRCDIR is specified," \
              "but does not contain gnulib-tool"
     if test -n "$GNULIB_REVISION" && $use_git; then
-      (cd "$GNULIB_SRCDIR" && git checkout "$GNULIB_REVISION") || exit $?
+      # The 'git checkout "$GNULIB_REVISION"' command succeeds if the
+      # GNULIB_REVISION is a commit hash that exists locally, or if it is
+      # branch name that can be fetched from origin. It fails, however,
+      # if the GNULIB_REVISION is a commit hash that only exists in origin.
+      # In this case, we need a 'git fetch' and then retry
+      # 'git checkout "$GNULIB_REVISION"'.
+      (cd "$GNULIB_SRCDIR" \
+       && { git checkout "$GNULIB_REVISION" 2>/dev/null \
+            || { git fetch origin && git checkout "$GNULIB_REVISION"; }
+          }
+      ) || exit $?
     fi
   else
     if ! $use_git; then