From: Paul Eggert Date: Fri, 17 May 2024 04:36:43 +0000 (-0700) Subject: maint: update bootstrap from Gnulib X-Git-Tag: v9.6~231 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b87c5c31059956f52ae883850ba309309871bff;p=thirdparty%2Fcoreutils.git maint: update bootstrap from Gnulib --- diff --git a/bootstrap b/bootstrap index 20913180a6..6295b8a128 100755 --- a/bootstrap +++ b/bootstrap @@ -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-28.09; # 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 @@ -569,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"