aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bpkg/fetch-git.cxx28
-rw-r--r--tests/remote-git.test20
-rw-r--r--tests/rep-fetch.test7
3 files changed, 27 insertions, 28 deletions
diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx
index 6cd5d6e..3dbb4eb 100644
--- a/bpkg/fetch-git.cxx
+++ b/bpkg/fetch-git.cxx
@@ -99,7 +99,7 @@ namespace bpkg
static string
git_string (const common_options&, const char* what, A&&... args);
- // Start git process. On the first call check that git version is 2.1.4 or
+ // Start git process. On the first call check that git version is 2.11.0 or
// above, and fail if that's not the case.
//
// Note that git is executed in the "sanitized" environment, having the
@@ -169,34 +169,12 @@ namespace bpkg
if (v.empty ())
fail << "unable to obtain git version from '" << s << "'" << endg;
- if (v.version < 20010040000)
+ if (v.version < 20110000000)
fail << "unsupported git version " << v.string () <<
- info << "minimum supported version is 2.1.4" << endf;
+ info << "minimum supported version is 2.11.0" << endf;
// Sanitize the environment.
//
- // Prio to 2.8.2 git required to run the rev-parse command in a
- // repository directory and failed otherwise. For these versions we
- // will use a precomputed (with 2.8.1) list of variables.
- //
- if (v.version < 20080020000)
- {
- unset_vars = strings ({"GIT_ALTERNATE_OBJECT_DIRECTORIES",
- "GIT_CONFIG",
- "GIT_OBJECT_DIRECTORY",
- "GIT_DIR",
- "GIT_WORK_TREE",
- "GIT_IMPLICIT_WORK_TREE",
- "GIT_GRAFT_FILE",
- "GIT_INDEX_FILE",
- "GIT_NO_REPLACE_OBJECTS",
- "GIT_REPLACE_REF_BASE",
- "GIT_PREFIX",
- "GIT_SHALLOW_FILE",
- "GIT_COMMON_DIR"});
- break;
- }
-
fdpipe pipe (open_pipe ());
// We assume that non-sanitized git environment can't harm this call.
diff --git a/tests/remote-git.test b/tests/remote-git.test
index 24b31e4..5214b35 100644
--- a/tests/remote-git.test
+++ b/tests/remote-git.test
@@ -11,13 +11,29 @@
# contain repositories produced) are not cleaned up.
#
+# Check that git version is the minimum supported one (2.11.0) or above.
+#
++git --version | set git_version_out
+
++echo "$git_version_out" | sed -n -e 's/git version (\d+\.\d+\.\d+).*/\1/p' | \
+ set git_version
+
++if ("$git_version" == "")
+ exit "unable to obtain git version from '$git_version_out'"
+end
+
++echo "$git_version" | sed -e 's/(\d+).*/\1/' | set git_version_major
++echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor
+
+git_supported = ($git_version_major > 2 || \
+ $git_version_major == 2 && $git_version_minor >= 11)
+
# Output directory path that testscripts must use to prepare repositories
# required by tests they contains.
#
out_git = $canonicalize([dir_path] $~/git/$cmd)
-# If $remote is true then remote repositories locations must be used for
-# tests.
+# If $remote is true then remote repository locations must be used for tests.
#
remote = $config.bpkg.test.remote
diff --git a/tests/rep-fetch.test b/tests/rep-fetch.test
index f3732e6..3630709 100644
--- a/tests/rep-fetch.test
+++ b/tests/rep-fetch.test
@@ -163,7 +163,12 @@ $* 2>>/EOE != 0
: git-repos
:
-if ($remote != true)
+if ($git_supported != true)
+{
+ # Skip git repository fetch tests.
+ #
+}
+elif ($remote != true)
{
git_protocol = 'local'
.include rep-fetch-git.test