Message ID | 20180512025833.22998-10-ricardo.martincoski@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | tests for git download infra v5 | expand |
On 12/05/2018 04:58, Ricardo Martincoski wrote: > From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br> > > Add a special ref to the static repo and check on the git refs test case > the download of a git package: > - with the name of a special ref as version; We might remove support for getting special refs by name, but keep on supporting getting special refs by sha1. So I've changed the test into getting it by sha1 instead. Ideally there should also be a check for getting the parent of the special ref by sha1, but I think that actually does *not* work now. Regards, Arnout
Hello, On Wed, Feb 06, 2019 at 08:05 AM, Arnout Vandecappelle wrote: > On 12/05/2018 04:58, Ricardo Martincoski wrote: >> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br> >> >> Add a special ref to the static repo and check on the git refs test case >> the download of a git package: >> - with the name of a special ref as version; > > We might remove support for getting special refs by name, but keep on > supporting getting special refs by sha1. So I've changed the test into getting > it by sha1 instead. OK... but it depends on a recent git version to work. The same does not occur when getting special refs by name. When using recent versions of git the download of the sha1 of a special ref works because of this line in support/download/git: _git fetch origin "'${cset}:${cset}'" I tested using: git version 2.17.1 The git version installed in our docker image does not support it. I am not sure what is the best fix for the TestGitRefs failure in GitLab CI. I would change the test to use special ref by name, and *when* we change the behavior, we change the test in the same commit to expect it to fail. > > Ideally there should also be a check for getting the parent of the special ref > by sha1, but I think that actually does *not* work now. I expect it to not work. But I didn't tested recently. Regards, Ricardo
On 18/02/2019 03:46, Ricardo Martincoski wrote: > Hello, > > On Wed, Feb 06, 2019 at 08:05 AM, Arnout Vandecappelle wrote: > >> On 12/05/2018 04:58, Ricardo Martincoski wrote: >>> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br> >>> >>> Add a special ref to the static repo and check on the git refs test case >>> the download of a git package: >>> - with the name of a special ref as version; >> >> We might remove support for getting special refs by name, but keep on >> supporting getting special refs by sha1. So I've changed the test into getting >> it by sha1 instead. > > OK... but it depends on a recent git version to work. Ah, darn, I forgot that... > The same does not occur when getting special refs by name. > > When using recent versions of git the download of the sha1 of a special ref > works because of this line in support/download/git: > _git fetch origin "'${cset}:${cset}'" So, IIRC, Yann had an idea for how to rewrite this in a way that we would (1) no longer support branch names and (2) we would support hashes that refer to special refs or ancestors of special refs. But I don't remember what it was. Maybe it was _git fetch origin '+refs/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*' That way (I think) a branch name would no longer be usable (because when doing the checkout the origin/ bit would be missing), but a tag name still would be usable. > I tested using: > git version 2.17.1 > > The git version installed in our docker image does not support it. > > I am not sure what is the best fix for the TestGitRefs failure in GitLab CI. > I would change the test to use special ref by name, and *when* we change the > behavior, we change the test in the same commit to expect it to fail. Or maybe just remove the test for now. Regards, Arnout > >> >> Ideally there should also be a check for getting the parent of the special ref >> by sha1, but I think that actually does *not* work now. > > I expect it to not work. But I didn't tested recently. > > Regards, > Ricardo >
Hello, On Tue, Feb 19, 2019 at 06:01 AM, Arnout Vandecappelle wrote: > On 18/02/2019 03:46, Ricardo Martincoski wrote: >> >> On Wed, Feb 06, 2019 at 08:05 AM, Arnout Vandecappelle wrote: >> >>> On 12/05/2018 04:58, Ricardo Martincoski wrote: >>>> From: Ricardo Martincoski <ricardo.martincoski@datacom.ind.br> >>>> >>>> Add a special ref to the static repo and check on the git refs test case >>>> the download of a git package: >>>> - with the name of a special ref as version; >>> >>> We might remove support for getting special refs by name, but keep on >>> supporting getting special refs by sha1. So I've changed the test into getting >>> it by sha1 instead. >> >> OK... but it depends on a recent git version to work. > > Ah, darn, I forgot that... > >> The same does not occur when getting special refs by name. >> >> When using recent versions of git the download of the sha1 of a special ref >> works because of this line in support/download/git: >> _git fetch origin "'${cset}:${cset}'" > > So, IIRC, Yann had an idea for how to rewrite this in a way that we would (1) > no longer support branch names and (2) we would support hashes that refer to > special refs or ancestors of special refs. But I don't remember what it was. > Maybe it was > > _git fetch origin '+refs/*:refs/remotes/origin/*' '+refs/tags/*:refs/tags/*' > > That way (I think) a branch name would no longer be usable (because when doing > the checkout the origin/ bit would be missing), but a tag name still would be > usable. I didn't tested it but I like the idea. > >> I tested using: >> git version 2.17.1 >> >> The git version installed in our docker image does not support it. >> >> I am not sure what is the best fix for the TestGitRefs failure in GitLab CI. >> I would change the test to use special ref by name, and *when* we change the >> behavior, we change the test in the same commit to expect it to fail. > > Or maybe just remove the test for now. OK. When new code is added to support hashes that refer to special refs the test can be added again. Regards, Ricardo
diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.hash b/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.hash new file mode 100644 index 0000000000..13e21aaeca --- /dev/null +++ b/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.hash @@ -0,0 +1,2 @@ +sha256 c639b15260d098d94b8802cae812453c9f878ffd5f80cca6d87c58c01eed5c5a git-special-ref-refs_changes_01_1_2.tar.gz +sha256 b252b594be4679764e2e06cfea77a3e50638dd445af9b472b0f298c43b134518 file diff --git a/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.mk b/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.mk new file mode 100644 index 0000000000..e7561bafca --- /dev/null +++ b/support/testing/tests/download/br2-external/git-refs/package/git-special-ref/git-special-ref.mk @@ -0,0 +1,11 @@ +################################################################################ +# +# git-special-ref +# +################################################################################ + +GIT_SPECIAL_REF_VERSION = refs/changes/01/1/2 +GIT_SPECIAL_REF_SITE = git://localhost:$(GITREMOTE_PORT_NUMBER)/repo.git +GIT_SPECIAL_REF_LICENSE_FILES = file + +$(eval $(generic-package)) diff --git a/support/testing/tests/download/git-remote/repo.git/objects/17/c409592968d17600ff9912e96fdd461bb72e74 b/support/testing/tests/download/git-remote/repo.git/objects/17/c409592968d17600ff9912e96fdd461bb72e74 new file mode 100644 index 0000000000000000000000000000000000000000..8c19de6455168ac65c81d70219e01eb2431c069e GIT binary patch literal 48 zcmb<m)YkO!4K*-JGB7bPFg6VIIDN)5l|$^(sx;1<Ig_pZOZptL5<kBEbgq)&X$db2 E0EbQzfdBvi literal 0 HcmV?d00001 diff --git a/support/testing/tests/download/git-remote/repo.git/objects/53/122a7b0454b33c6d9e159c10657173db77899e b/support/testing/tests/download/git-remote/repo.git/objects/53/122a7b0454b33c6d9e159c10657173db77899e new file mode 100644 index 0000000000000000000000000000000000000000..d72d49eed56298f84aaf85967dbf051da94f3871 GIT binary patch literal 27 icmb<m^geacKghr&MMKZS_ngleO)uZaObmAQY+e9~zX?PD literal 0 HcmV?d00001 diff --git a/support/testing/tests/download/git-remote/repo.git/objects/b7/2ff6078f62522a87f5cae5e9f34dedf5ec3885 b/support/testing/tests/download/git-remote/repo.git/objects/b7/2ff6078f62522a87f5cae5e9f34dedf5ec3885 new file mode 100644 index 0000000000000000000000000000000000000000..6727b2e8083f2a31c48e849caa4cd772a6778e07 GIT binary patch literal 186 zcmV;r07d_J0j<tKP6QzkKvCD6f(!Jd3TU8=F<!upo`9x`k<8Fc7+iRJJ8|LOxP6PC zpL=U{YHR3W4iSwZJD`;e`N$YNKq*9MgnVIk9=9zR2~OS8kbUZ8Y}}Ab=4e)SfunV) z*t{BJ-4TlpkqKC(&-u}ZeyceR?)o*2S@+!Um#Uw}51!gDzMNaC*HiB8S>p<UJc0{) o0SllGJ*KDpQ%>D)l54sSDN4Q9^DeyfQkL!O@h`vX8x-PgzB#pAi~s-t literal 0 HcmV?d00001 diff --git a/support/testing/tests/download/git-remote/repo.git/refs/changes/01/1/2 b/support/testing/tests/download/git-remote/repo.git/refs/changes/01/1/2 new file mode 100644 index 0000000000..7066394dd0 --- /dev/null +++ b/support/testing/tests/download/git-remote/repo.git/refs/changes/01/1/2 @@ -0,0 +1 @@ +b72ff6078f62522a87f5cae5e9f34dedf5ec3885 diff --git a/support/testing/tests/download/test_git.py b/support/testing/tests/download/test_git.py index ce3655121c..162c03623b 100644 --- a/support/testing/tests/download/test_git.py +++ b/support/testing/tests/download/test_git.py @@ -75,6 +75,7 @@ class TestGitRefs(GitTestBase): self.check_download("git-sha1-reachable-by-tag") self.check_download("git-sha1-tag-itself") self.check_download("git-sha1-tag-points-to") + self.check_download("git-special-ref") self.check_download("git-submodule-disabled") self.check_download("git-submodule-enabled") self.check_download("git-tag")