From f2569bd8b6cff7f17ae71035cc3d4e86b2fc0cc4 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 20 Jun 2019 13:16:52 +0300 Subject: Adapt rep-fetch tests to full support of git versions prior to 2.14 --- tests/remote-git.testscript | 15 ++++++++++----- tests/rep-fetch-git-commit.testscript | 1 - tests/rep-fetch-git-refname.testscript | 6 +++--- tests/rep-fetch-git.testscript | 4 ++++ tests/rep-fetch.testscript | 15 +++++++++++++++ 5 files changed, 32 insertions(+), 9 deletions(-) (limited to 'tests') diff --git a/tests/remote-git.testscript b/tests/remote-git.testscript index 56c33b7..81e7c54 100644 --- a/tests/remote-git.testscript +++ b/tests/remote-git.testscript @@ -27,15 +27,11 @@ end +echo "$git_version" | sed -e 's/\d+\.(\d+).*/\1/' | set git_version_minor # These flags must be used by testscripts to decide if they should skip git -# repository-related tests. See bpkg/fetch-git.cxx for the functionality -# reduction details for partially supported git versions. +# repository-related tests. # git_supported = ($git_version_major > 2 || \ $git_version_major == 2 && $git_version_minor >= 11) -git_fully_supported = ($git_version_major > 2 || \ - $git_version_major == 2 && $git_version_minor >= 14) - # Output directory path that testscripts must use to prepare repositories # required by tests they contain. # @@ -66,6 +62,15 @@ else rep_git_git = "git://git.build2.org/testing/bpkg/advonly/$cmd" rep_git_ssh = "ssh://git.build2.org/var/scm/testing/bpkg/advonly/$cmd" + # Note that we assume the git and ssh protocols as smart and never as unadv + # (see fetch-git.cxx for details). However, git may behave differently + # depending on the server setup (due to bugs, etc). That's why we test + # against different server configurations to make sure that nothing falls + # apart. + # + rep_git_git_unadv = "git://git.build2.org/testing/bpkg/unadv/$cmd" + rep_git_ssh_unadv = "ssh://git.build2.org/var/scm/testing/bpkg/unadv/$cmd" + rep_git = $rep_git_https_dumb # Default remote repository URL. end diff --git a/tests/rep-fetch-git-commit.testscript b/tests/rep-fetch-git-commit.testscript index 8af9ea1..fd406e1 100644 --- a/tests/rep-fetch-git-commit.testscript +++ b/tests/rep-fetch-git-commit.testscript @@ -7,7 +7,6 @@ : unadvertised : -if ($git_fully_supported || $git_protocol != 'https-smart-unadv') { +git -C ../style-basic log '--pretty=format:%H' --all --grep='README' | \ set commit diff --git a/tests/rep-fetch-git-refname.testscript b/tests/rep-fetch-git-refname.testscript index 37fdcba..7bf52ee 100644 --- a/tests/rep-fetch-git-refname.testscript +++ b/tests/rep-fetch-git-refname.testscript @@ -39,7 +39,6 @@ : changed : - if ($git_fully_supported || $git_protocol != 'https-smart-unadv') { g = git -C u = "$rep_git/state1" @@ -66,8 +65,10 @@ if ($git_protocol == 'local' || \ $git_protocol == 'https-smart' || \ + $git_protocol == 'git' || \ + $git_protocol == 'git-unadv' || \ $git_protocol == 'ssh' || \ - $git_protocol == 'git') + $git_protocol == 'ssh-unadv') warn2 = "$warn_repo_hist for submodule 'doc/style/basic'$reason_unadv" elif ($git_protocol == 'https-dumb') warn1 = "$warn_ref_hist for submodule 'doc/style'$reason_dumb$warn_dumb" @@ -164,7 +165,6 @@ : no-progress : - if ($git_fully_supported || $git_protocol != 'https-smart-unadv') { $clone_root_cfg && $rep_add "$rep/state0/libfoo.git$fragment"; diff --git a/tests/rep-fetch-git.testscript b/tests/rep-fetch-git.testscript index aaf9ce5..8b5b010 100644 --- a/tests/rep-fetch-git.testscript +++ b/tests/rep-fetch-git.testscript @@ -29,8 +29,12 @@ elif ($git_protocol == 'https-smart-unadv') rep = "$rep_git_https_smart_unadv" elif ($git_protocol == 'git') rep = "$rep_git_git" +elif ($git_protocol == 'git-unadv') + rep = "$rep_git_git_unadv" elif ($git_protocol == 'ssh') rep = "$rep_git_ssh" +elif ($git_protocol == 'ssh-unadv') + rep = "$rep_git_ssh_unadv" else exit "unexpected git protocol '$git_protocol'" end diff --git a/tests/rep-fetch.testscript b/tests/rep-fetch.testscript index c2fd4cc..cd1c919 100644 --- a/tests/rep-fetch.testscript +++ b/tests/rep-fetch.testscript @@ -733,6 +733,13 @@ else .include rep-fetch-git.testscript } + : git-unadv + : + { + git_protocol = 'git-unadv' + .include rep-fetch-git.testscript + } + : ssh : if ($git_ssh == true) @@ -740,6 +747,14 @@ else git_protocol = 'ssh' .include rep-fetch-git.testscript } + + : ssh-unadv + : + if ($git_ssh == true) + { + git_protocol = 'ssh-unadv' + .include rep-fetch-git.testscript + } } : strip-ext -- cgit v1.1