aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-06-15 23:48:59 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-06-18 16:14:56 +0300
commit35b19af5bb585276821dc17f0f487d6cd2ece598 (patch)
tree60fcadcaf5c68da13f326f783c94fcf63a197513 /tests
parent5598e284b9337872608d478854643f12d1d34751 (diff)
Fix failure to fetch git repository location with tagged commit id for git 2.22
Also make some cleanups (always probe URLs prior to git-ls-remote, use peeled reference ids to identify repository fragments, etc).
Diffstat (limited to 'tests')
-rwxr-xr-xtests/common/git/init4
-rw-r--r--tests/common/git/state0/libbar.tarbin174080 -> 174080 bytes
-rw-r--r--tests/common/git/state0/libfoo.tarbin440320 -> 450560 bytes
-rw-r--r--tests/common/git/state0/libfox.tarbin245760 -> 245760 bytes
-rw-r--r--tests/common/git/state0/links.tarbin276480 -> 276480 bytes
-rw-r--r--tests/common/git/state0/style-basic.tarbin81920 -> 81920 bytes
-rw-r--r--tests/common/git/state0/style.tarbin143360 -> 143360 bytes
-rw-r--r--tests/common/git/state1/libbaz.tarbin61440 -> 61440 bytes
-rw-r--r--tests/common/git/state1/libfoo.tarbin501760 -> 512000 bytes
-rw-r--r--tests/common/git/state1/libfox.tarbin245760 -> 245760 bytes
-rw-r--r--tests/common/git/state1/style-basic.tarbin81920 -> 81920 bytes
-rw-r--r--tests/common/git/state1/style.tarbin143360 -> 143360 bytes
-rwxr-xr-xtests/publish2
-rw-r--r--tests/remote-git.testscript4
-rw-r--r--tests/rep-fetch-git-commit.testscript35
-rw-r--r--tests/rep-fetch.testscript2
16 files changed, 42 insertions, 5 deletions
diff --git a/tests/common/git/init b/tests/common/git/init
index 9519779..8cac2da 100755
--- a/tests/common/git/init
+++ b/tests/common/git/init
@@ -114,8 +114,10 @@ git -C style-basic.git checkout master
#
git -C libbar.git init
git -C libbar.git add '*'
-git -C libbar.git submodule add -b stable ../style-basic.git extras
git -C libbar.git commit -am 'Create'
+git -C libbar.git tag -a 'v1.0.0' -m 'Tag version 1.0.0'
+git -C libbar.git submodule add -b stable ../style-basic.git extras
+git -C libbar.git commit -am 'Add extras'
# Create master branch for libfoo.git, adding style.git and libbar.git as
# submodules.
diff --git a/tests/common/git/state0/libbar.tar b/tests/common/git/state0/libbar.tar
index b63a7b5..cf00747 100644
--- a/tests/common/git/state0/libbar.tar
+++ b/tests/common/git/state0/libbar.tar
Binary files differ
diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar
index 200ebf5..05281ee 100644
--- a/tests/common/git/state0/libfoo.tar
+++ b/tests/common/git/state0/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state0/libfox.tar b/tests/common/git/state0/libfox.tar
index df77539..b024532 100644
--- a/tests/common/git/state0/libfox.tar
+++ b/tests/common/git/state0/libfox.tar
Binary files differ
diff --git a/tests/common/git/state0/links.tar b/tests/common/git/state0/links.tar
index 25c4089..3769fd1 100644
--- a/tests/common/git/state0/links.tar
+++ b/tests/common/git/state0/links.tar
Binary files differ
diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar
index 7223c52..01eadbc 100644
--- a/tests/common/git/state0/style-basic.tar
+++ b/tests/common/git/state0/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar
index 93007d5..042684e 100644
--- a/tests/common/git/state0/style.tar
+++ b/tests/common/git/state0/style.tar
Binary files differ
diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar
index d46b25c..5238b4a 100644
--- a/tests/common/git/state1/libbaz.tar
+++ b/tests/common/git/state1/libbaz.tar
Binary files differ
diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar
index 683f5ab..c0e7523 100644
--- a/tests/common/git/state1/libfoo.tar
+++ b/tests/common/git/state1/libfoo.tar
Binary files differ
diff --git a/tests/common/git/state1/libfox.tar b/tests/common/git/state1/libfox.tar
index 49c4752..e502974 100644
--- a/tests/common/git/state1/libfox.tar
+++ b/tests/common/git/state1/libfox.tar
Binary files differ
diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar
index 5ab346d..1ef7399 100644
--- a/tests/common/git/state1/style-basic.tar
+++ b/tests/common/git/state1/style-basic.tar
Binary files differ
diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar
index 71be292..2a0120b 100644
--- a/tests/common/git/state1/style.tar
+++ b/tests/common/git/state1/style.tar
Binary files differ
diff --git a/tests/publish b/tests/publish
index df355eb..bd1f327 100755
--- a/tests/publish
+++ b/tests/publish
@@ -60,7 +60,7 @@ for r in $(find test -type d -regex '.*/git/.*/[^/]+\.git'); do
# Push local branches and tags to the remote repository, if it exists.
#
- if git ls-remote "$url" 2>/dev/null >&2; then
+ if git ls-remote --refs "$url" 2>/dev/null >&2; then
# Point the bare repository origin to the remote repository.
#
git -C $br config remote.origin.url "$url"
diff --git a/tests/remote-git.testscript b/tests/remote-git.testscript
index 40f7ae5..56c33b7 100644
--- a/tests/remote-git.testscript
+++ b/tests/remote-git.testscript
@@ -63,8 +63,8 @@ else
rep_git_https_dumb = "https://build2.org/bpkg/git/$cmd"
rep_git_https_smart = "https://git.build2.org/testing/bpkg/advonly/$cmd"
rep_git_https_smart_unadv = "https://git.build2.org/testing/bpkg/unadv/$cmd"
- rep_git_git = "git://git.build2.org/testing/bpkg/unadv/$cmd"
- rep_git_ssh = "ssh://git.build2.org/var/scm/testing/bpkg/unadv/$cmd"
+ rep_git_git = "git://git.build2.org/testing/bpkg/advonly/$cmd"
+ rep_git_ssh = "ssh://git.build2.org/var/scm/testing/bpkg/advonly/$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 3f0fbe7..8af9ea1 100644
--- a/tests/rep-fetch-git-commit.testscript
+++ b/tests/rep-fetch-git-commit.testscript
@@ -3,6 +3,7 @@
# license : MIT; see accompanying LICENSE file
+git clone "$rep_git/state0/style-basic.git" 2>! &style-basic/***
++git clone "$rep_git/state0/libbar.git" 2>! &libbar/***
: unadvertised
:
@@ -94,3 +95,37 @@ if ($git_fully_supported || $git_protocol != 'https-smart-unadv')
EOE
}
}
+
+: peeled
+:
+{
+ +git -C ../libbar log '--pretty=format:%H' --all --grep='Create' | \
+ set commit
+
+ : remap
+ :
+ : Test that the commit id is properly remapped back to the advertised tag
+ : reference.
+ :
+ {
+ $clone_root_cfg && $rep_add "$rep/state0/libbar.git#@$commit";
+
+ $* 2>>~"%EOE%"
+ %fetching git:.+libbar#@$commit%
+ %.+
+ EOE
+ }
+
+ : peel
+ :
+ : Test that the tag reference is properly peeled into the commit id.
+ :
+ {
+ $clone_root_cfg && $rep_add "$rep/state0/libbar.git#v1.0.0,-$commit";
+
+ $* 2>>~%EOE%
+ %.+
+ 0 package(s) in 1 repository(s)
+ EOE
+ }
+}
diff --git a/tests/rep-fetch.testscript b/tests/rep-fetch.testscript
index 8e7011a..c2fd4cc 100644
--- a/tests/rep-fetch.testscript
+++ b/tests/rep-fetch.testscript
@@ -809,7 +809,7 @@ else
{
$clone_root_cfg && $rep_add "$rep_git_git/state0/libfoo.git#master";
$* 2>! &cfg/.bpkg/repos/*/***;
- $rep_add "$rep_git_https_smart_unadv/state0/libfoo.git#master";
+ $rep_add "$rep_git_https_smart/state0/libfoo.git#master";
$* 2>>~%EOE%
%fetching git:.+libfoo#master%