fetch/git: Ensure tags work with shallow clones
PATCH 1/1 fetch/git: Ensure tags work with shallow clones
If we want to validate a tag when using shallow clones, we need to ensure the tag is imported to the clone. Adding to extra_refs allows this to happen ensuring tag validation in shallow clones works.
--- lib/bb/fetch2/git.py | 2 ++ 1 file changed, 2 insertions(+)
lib/bb/fetch2/git.py +2 -0
@@ -674,6 +674,8 @@ class Git(FetchMethod): for line in all_refs_remote: all_refs.append(line.split()[-1]) extra_refs = [] + if 'tag' in ud.parm: + extra_refs.append(ud.parm['tag']) for r in ud.shallow_extra_refs: if not ud.bareclone: r = r.replace('refs/heads/', 'refs/remotes/origin/')
Hello Richard,
Thanks for this patch,
Could we also add the tag to git shallow tarball filename? Or make some other filename change?
I don't want to re-write all existing shallow tarballs in our mirror, which would be now failing to verify the tag.
Thanks,
Peter
Quoted 30 lines
-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie via lists.openembedded.org
Sent: Tuesday, March 18, 2025 13:16
To: [email protected]
Subject: [bitbake-devel] [PATCH] fetch/git: Ensure tags work with shallow clonesIf we want to validate a tag when using shallow clones, we need to ensure the tag is imported to the clone. Adding to
extra_refsallows this to happen ensuring tag validation in shallow clones works.Signed-off-by Richard Purdie <[email protected]>--- lib/bb/fetch2/git.py | 2 ++ 1 file changed, 2 insertions(+)lib/bb/fetch2/git.py +2
-0@@ -674,6 +674,8 @@ class Git(FetchMethod): for line in all_refs_remote: all_refs.append(line.split()[-1]) extra_refs = [] + if 'tag' in ud.parm: + extra_refs.append(ud.parm['tag']) for r in ud.shallow_extra_refs: if not ud.bareclone: r = r.replace('refs/heads/', 'refs/remotes/origin/')
Thinking about it again, I think it's not necessary to change filename. Tags will anyway be needed only on upgrades, so new tarball will be generated.
Sorry for unnecessary spam.
Peter
Quoted 49 lines
-----Original Message-----
From: Marko, Peter (FT D EU SK BFS1)
Sent: Tuesday, March 18, 2025 13:23
To: [email protected]; [email protected]
Subject: RE: [bitbake-devel] [PATCH] fetch/git: Ensure tags work with shallow clonesHello Richard,
Thanks for this patch,
Could we also add the tag to git shallow tarball filename? Or make some other filename change?I don't want to re-write all existing shallow tarballs in our mirror, which would be now failing to verify the tag.
Thanks,
PeterQuoted 30 lines
-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Richard Purdie via lists.openembedded.org
Sent: Tuesday, March 18, 2025 13:16
To: [email protected]
Subject: [bitbake-devel] [PATCH] fetch/git: Ensure tags work with shallow clonesIf we want to validate a tag when using shallow clones, we need to ensure the tag is imported to the clone. Adding to
extra_refsallows this to happen ensuring tag validation in shallow clones works.Signed-off-by Richard Purdie <[email protected]>--- lib/bb/fetch2/git.py | 2 ++ 1 file changed, 2 insertions(+)lib/bb/fetch2/git.py +2
-0@@ -674,6 +674,8 @@ class Git(FetchMethod): for line in all_refs_remote: all_refs.append(line.split()[-1]) extra_refs = [] + if 'tag' in ud.parm: + extra_refs.append(ud.parm['tag']) for r in ud.shallow_extra_refs: if not ud.bareclone: r = r.replace('refs/heads/', 'refs/remotes/origin/')