According to Jim Meyering on 2/17/2010 10:21 AM:
>> or should we just assume that git 1.6.4 or newer is widespread enough to
>> not be worth the hassle?
> 
> I'd prefer to assume git 1.6.4 to keep things simpler, at least until
> someone comes up with a compelling reason to add code to support older git.

Libvirt came up with the compelling reason - Fedora Core 11 only has
1.6.2.5, and RPEL 5 is back at git 1.5.5.  This should fix it, by
borrowing ideas from m4's bootstrap script.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
From 980a90b55fd2721864880aed353bd05ba5b69365 Mon Sep 17 00:00:00 2001
From: Eric Blake <ebl...@redhat.com>
Date: Wed, 24 Feb 2010 09:48:16 -0700
Subject: [PATCH] bootstrap: allow older git

git 1.6.4 is too new to be universally available yet.

* build-aux/bootstrap (GNULIB_SRCDIR): Add fallback if git is
older than 1.6.4.  Requested by the libvirt project.

Signed-off-by: Eric Blake <ebl...@redhat.com>
---
 ChangeLog           |    6 ++++++
 build-aux/bootstrap |   20 ++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 49e035d..37e30fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-02-24  Eric Blake  <ebl...@redhat.com>
+
+       bootstrap: allow older git
+       * build-aux/bootstrap (GNULIB_SRCDIR): Add fallback if git is
+       older than 1.6.4.  Requested by the libvirt project.
+
 2010-02-17  Eric Blake  <e...@byu.net>

        manywarnings: add more warnings
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index bd23856..656886d 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -431,12 +431,28 @@ case ${GNULIB_SRCDIR--} in
   GNULIB_SRCDIR=$gnulib_path
   ;;
 *)
-  # Use GNULIB_SRCDIR as a reference.  Assumes git 1.6.4 or newer.
+  # Use GNULIB_SRCDIR as a reference.
   if test -d "$GNULIB_SRCDIR"/.git && \
         git_modules_config submodule.gnulib.url >/dev/null; then
     echo "$0: getting gnulib files..."
-    git submodule update --init --reference "$GNULIB_SRCDIR" \
+    if git submodule --help|grep reference > /dev/null; then
+      # Prefer the one-liner available in git 1.6.4 or newer.
+      git submodule update --init --reference "$GNULIB_SRCDIR" \
         "$gnulib_path" || exit $?
+    else
+      # This fallback allows at least git 1.5.5.
+      if test -f "$gnulib_path"/gnulib-tool; then
+        # Since file already exists, assume submodule init already complete.
+        git submodule update || exit $?
+      else
+        # Older git can't clone into an empty directory.
+        rmdir "$gnulib_path" 2>/dev/null
+        git clone --reference "$GNULIB_SRCDIR" \
+          "`git_modules_config submodule.gnulib.url`" "$gnulib_path" \
+          && git submodule init && git submodule update \
+          || exit $?
+      fi
+    fi
     GNULIB_SRCDIR=$gnulib_path
   fi
   ;;
-- 
1.6.6.1

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to