From 35b19af5bb585276821dc17f0f487d6cd2ece598 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 15 Jun 2019 23:48:59 +0300 Subject: 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). --- tests/common/git/init | 4 +++- tests/common/git/state0/libbar.tar | Bin 174080 -> 174080 bytes tests/common/git/state0/libfoo.tar | Bin 440320 -> 450560 bytes tests/common/git/state0/libfox.tar | Bin 245760 -> 245760 bytes tests/common/git/state0/links.tar | Bin 276480 -> 276480 bytes tests/common/git/state0/style-basic.tar | Bin 81920 -> 81920 bytes tests/common/git/state0/style.tar | Bin 143360 -> 143360 bytes tests/common/git/state1/libbaz.tar | Bin 61440 -> 61440 bytes tests/common/git/state1/libfoo.tar | Bin 501760 -> 512000 bytes tests/common/git/state1/libfox.tar | Bin 245760 -> 245760 bytes tests/common/git/state1/style-basic.tar | Bin 81920 -> 81920 bytes tests/common/git/state1/style.tar | Bin 143360 -> 143360 bytes tests/publish | 2 +- tests/remote-git.testscript | 4 ++-- tests/rep-fetch-git-commit.testscript | 35 ++++++++++++++++++++++++++++++++ tests/rep-fetch.testscript | 2 +- 16 files changed, 42 insertions(+), 5 deletions(-) (limited to 'tests') 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 Binary files a/tests/common/git/state0/libbar.tar and b/tests/common/git/state0/libbar.tar differ diff --git a/tests/common/git/state0/libfoo.tar b/tests/common/git/state0/libfoo.tar index 200ebf5..05281ee 100644 Binary files a/tests/common/git/state0/libfoo.tar and b/tests/common/git/state0/libfoo.tar differ diff --git a/tests/common/git/state0/libfox.tar b/tests/common/git/state0/libfox.tar index df77539..b024532 100644 Binary files a/tests/common/git/state0/libfox.tar and b/tests/common/git/state0/libfox.tar differ diff --git a/tests/common/git/state0/links.tar b/tests/common/git/state0/links.tar index 25c4089..3769fd1 100644 Binary files a/tests/common/git/state0/links.tar and b/tests/common/git/state0/links.tar differ diff --git a/tests/common/git/state0/style-basic.tar b/tests/common/git/state0/style-basic.tar index 7223c52..01eadbc 100644 Binary files a/tests/common/git/state0/style-basic.tar and b/tests/common/git/state0/style-basic.tar differ diff --git a/tests/common/git/state0/style.tar b/tests/common/git/state0/style.tar index 93007d5..042684e 100644 Binary files a/tests/common/git/state0/style.tar and b/tests/common/git/state0/style.tar differ diff --git a/tests/common/git/state1/libbaz.tar b/tests/common/git/state1/libbaz.tar index d46b25c..5238b4a 100644 Binary files a/tests/common/git/state1/libbaz.tar and b/tests/common/git/state1/libbaz.tar differ diff --git a/tests/common/git/state1/libfoo.tar b/tests/common/git/state1/libfoo.tar index 683f5ab..c0e7523 100644 Binary files a/tests/common/git/state1/libfoo.tar and b/tests/common/git/state1/libfoo.tar differ diff --git a/tests/common/git/state1/libfox.tar b/tests/common/git/state1/libfox.tar index 49c4752..e502974 100644 Binary files a/tests/common/git/state1/libfox.tar and b/tests/common/git/state1/libfox.tar differ diff --git a/tests/common/git/state1/style-basic.tar b/tests/common/git/state1/style-basic.tar index 5ab346d..1ef7399 100644 Binary files a/tests/common/git/state1/style-basic.tar and b/tests/common/git/state1/style-basic.tar differ diff --git a/tests/common/git/state1/style.tar b/tests/common/git/state1/style.tar index 71be292..2a0120b 100644 Binary files a/tests/common/git/state1/style.tar and b/tests/common/git/state1/style.tar 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% -- cgit v1.1