From 2b3ee000c596ff27d24415cb498e1fc3439d2249 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 2 Nov 2018 00:26:19 +0300 Subject: Fix minimum supported git version raising it to 2.14.0 from 2.12.0 Prior to 2.14.0 the git-fetch command doesn't accept commit id as a refspec which we rely upon. --- bpkg/fetch-git.cxx | 14 ++++++++++---- tests/remote-git.testscript | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/bpkg/fetch-git.cxx b/bpkg/fetch-git.cxx index cd5d597..20bad96 100644 --- a/bpkg/fetch-git.cxx +++ b/bpkg/fetch-git.cxx @@ -74,10 +74,16 @@ namespace bpkg static string git_line (const common_options&, const char* what, A&&... args); - // Start git process. On the first call check that git version is 2.12.0 or + // Start git process. On the first call check that git version is 2.14.0 or // above, and fail if that's not the case. // - // Note that git is executed in the "sanitized" environment, having the + // Note that prior to 2.14.0 the git-fetch command doesn't accept commit id + // as a refspec: + // + // $ git fetch --no-recurse-submodules --depth 1 origin 5e8245ee3526530a3467f59b0601bbffb614f45b + // error: Server does not allow request for unadvertised object 5e8245ee3526530a3467f59b0601bbffb614f45b + // + // Also note that git is executed in the "sanitized" environment, having the // environment variables that are local to the repository being unset (all // except GIT_CONFIG_PARAMETERS). We do the same as the git-submodule script // does for commands executed for submodules. Though we do it for all @@ -118,9 +124,9 @@ namespace bpkg info << "produced by '" << co.git () << "'; " << "use --git to override" << endg; - if (*v < semantic_version {2, 12, 0}) + if (*v < semantic_version {2, 14, 0}) fail << "unsupported git version " << *v << - info << "minimum supported version is 2.12.0" << endf; + info << "minimum supported version is 2.14.0" << endf; // Sanitize the environment. // diff --git a/tests/remote-git.testscript b/tests/remote-git.testscript index 6724473..2ce0fa0 100644 --- a/tests/remote-git.testscript +++ b/tests/remote-git.testscript @@ -11,7 +11,8 @@ # contain repositories produced) are not cleaned up. # -# Check that git version is the minimum supported one (2.12.0) or above. +# Check that git version is the minimum supported one (2.14.0) or above (see +# bpkg/fetch-git.cxx for details). # +git --version | set git_version_out @@ -29,7 +30,7 @@ end # repository-related tests. # git_supported = ($git_version_major > 2 || \ - $git_version_major == 2 && $git_version_minor >= 12) + $git_version_major == 2 && $git_version_minor >= 14) # Output directory path that testscripts must use to prepare repositories # required by tests they contain. -- cgit v1.1