]> Savannah Git Hosting - gnulib.git/commitdiff
bootstrap: Support checking out a recent GNULIB_REVISION, part 2.
authorBruno Haible <bruno@clisp.org>
Sun, 28 Apr 2024 09:29:27 +0000 (11:29 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 28 Apr 2024 09:32:43 +0000 (11:32 +0200)
Reported by Markus Mützel <markus.muetzel@gmx.de> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00507.html>.

* top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If using a submodule
and 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 30afe4b1908c2986048c2809e4cad8ad0c5f3012..5948faf1028f8a2fd45e8037cdd7bf76215fdcbb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-04-28  Bruno Haible  <bruno@clisp.org>
+
+       bootstrap: Support checking out a recent GNULIB_REVISION, part 2.
+       Reported by Markus Mützel <markus.muetzel@gmx.de> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00507.html>.
+       * top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR): If using a submodule
+       and the 'git checkout' command fails, fetch the newer commits and then
+       retry it.
+       * build-aux/bootstrap: Regenerated.
+
 2024-04-27  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Preserve module ordering in --create-megatestdir.
index 8d0b97d43602bf215119ad42689ade069db5b8a2..6295b8a128f667ea3f317e04efea28c9be526dca 100755 (executable)
@@ -37,7 +37,7 @@ medir=`dirname "$me"`
 
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-04-27.17; # UTC
+scriptlibversion=2024-04-28.09; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -502,8 +502,8 @@ prepare_GNULIB_SRCDIR ()
       # 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
+      # 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 \
@@ -579,7 +579,17 @@ prepare_GNULIB_SRCDIR ()
         # The subdirectory 'gnulib' already exists.
         if test -n "$GNULIB_REVISION"; then
           if test -d "$gnulib_path/.git"; then
-            (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") || exit 1
+            # 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_path" \
+             && { git checkout "$GNULIB_REVISION" 2>/dev/null \
+                  || { git fetch origin && git checkout "$GNULIB_REVISION"; }
+                }
+            ) || exit $?
           else
             die "Error: GNULIB_REVISION is specified in bootstrap.conf," \
                 "but '$gnulib_path' contains no git history"
index 620006d320b4dcde43f4224112736ede08e39a9b..f7905eb208256f59b25e489c0e7243dc6f1db537 100644 (file)
@@ -1,6 +1,6 @@
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-04-27.17; # UTC
+scriptlibversion=2024-04-28.09; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -465,8 +465,8 @@ prepare_GNULIB_SRCDIR ()
       # 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
+      # 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 \
@@ -542,7 +542,17 @@ prepare_GNULIB_SRCDIR ()
         # The subdirectory 'gnulib' already exists.
         if test -n "$GNULIB_REVISION"; then
           if test -d "$gnulib_path/.git"; then
-            (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") || exit 1
+            # 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_path" \
+             && { git checkout "$GNULIB_REVISION" 2>/dev/null \
+                  || { git fetch origin && git checkout "$GNULIB_REVISION"; }
+                }
+            ) || exit $?
           else
             die "Error: GNULIB_REVISION is specified in bootstrap.conf," \
                 "but '$gnulib_path' contains no git history"