Message ID | 20250318121540.4123354-1-richard.purdie@linuxfoundation.org |
---|---|
State | Accepted, archived |
Commit | 03945475886b8d31c7eccc80fe594ab5306bcf5d |
Headers | show |
Series | fetch/git: Ensure tags work with shallow clones | expand |
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 > -----Original Message----- > From: bitbake-devel@lists.openembedded.org <bitbake- > devel@lists.openembedded.org> On Behalf Of Richard Purdie via > lists.openembedded.org > Sent: Tuesday, March 18, 2025 13:16 > To: bitbake-devel@lists.openembedded.org > Subject: [bitbake-devel] [PATCH] 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. > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > --- > lib/bb/fetch2/git.py | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > index 53fdc4c3df..7fda9d2753 100644 > --- a/lib/bb/fetch2/git.py > +++ b/lib/bb/fetch2/git.py > @@ -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 > -----Original Message----- > From: Marko, Peter (FT D EU SK BFS1) > Sent: Tuesday, March 18, 2025 13:23 > To: richard.purdie@linuxfoundation.org; bitbake-devel@lists.openembedded.org > Subject: RE: [bitbake-devel] [PATCH] fetch/git: Ensure tags work with shallow > clones > > 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 > > > -----Original Message----- > > From: bitbake-devel@lists.openembedded.org <bitbake- > > devel@lists.openembedded.org> On Behalf Of Richard Purdie via > > lists.openembedded.org > > Sent: Tuesday, March 18, 2025 13:16 > > To: bitbake-devel@lists.openembedded.org > > Subject: [bitbake-devel] [PATCH] 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. > > > > Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> > > --- > > lib/bb/fetch2/git.py | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py > > index 53fdc4c3df..7fda9d2753 100644 > > --- a/lib/bb/fetch2/git.py > > +++ b/lib/bb/fetch2/git.py > > @@ -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/')
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py index 53fdc4c3df..7fda9d2753 100644 --- a/lib/bb/fetch2/git.py +++ b/lib/bb/fetch2/git.py @@ -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/')
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- lib/bb/fetch2/git.py | 2 ++ 1 file changed, 2 insertions(+)