All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fetch2/git: Only fetch extra shallow refs that exist
@ 2026-06-20 17:44 Peter Kjellerstedt
  2026-06-23  8:07 ` [bitbake-devel] " Mathieu Dubois-Briand
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Kjellerstedt @ 2026-06-20 17:44 UTC (permalink / raw)
  To: bitbake-devel

When using BB_GIT_SHALLOW_EXTRA_REFS in combination with a recipe that
fetches multiple URLs, make sure to only fetch the references that exist
in the respective remote repositories.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 lib/bb/fetch2/git.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 0fbd85441..3f723ca62 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -640,7 +640,7 @@ class Git(FetchMethod):
             if '*' in r:
                 matches = filter(lambda a: fnmatch.fnmatchcase(a, r), all_refs)
                 extra_refs.extend(matches)
-            else:
+            elif r in all_refs:
                 extra_refs.append(r)
 
         for ref in extra_refs:


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [bitbake-devel] [PATCH] fetch2/git: Only fetch extra shallow refs that exist
  2026-06-20 17:44 [PATCH] fetch2/git: Only fetch extra shallow refs that exist Peter Kjellerstedt
@ 2026-06-23  8:07 ` Mathieu Dubois-Briand
  0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Dubois-Briand @ 2026-06-23  8:07 UTC (permalink / raw)
  To: peter.kjellerstedt, bitbake-devel

On Sat Jun 20, 2026 at 7:44 PM CEST, Peter Kjellerstedt via lists.openembedded.org wrote:
> When using BB_GIT_SHALLOW_EXTRA_REFS in combination with a recipe that
> fetches multiple URLs, make sure to only fetch the references that exist
> in the respective remote repositories.
>
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---

Hi Peter,

I suspect this is breaking the GitShallowTest bitbake selftest:

ERROR: test_shallow_extra_refs (bb.tests.fetch.GitShallowTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/tests/fetch.py", line 2250, in test_shallow_extra_refs
    self.assertRefs(['master', 'origin/master', 'origin/a_branch'])
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/tests/fetch.py", line 1866, in assertRefs
    full_expected = self.git(['rev-parse', '--symbolic-full-name'] + expected_refs, cwd=cwd).splitlines()
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/tests/fetch.py", line 438, in git
    return bb.process.run(cmd, cwd=cwd)[0]
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/process.py", line 189, in run
    raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
bb.process.ExecutionError: Execution of 'git -c safe.bareRepository=all rev-parse --symbolic-full-name master origin/master origin/a_branch' failed with exit code 128:
fatal: ambiguous argument 'origin/a_branch': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
refs/heads/master
refs/remotes/origin/master
origin/a_branch

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/4178
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/4119
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/3949

Can you have a look at the issue?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-23  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-20 17:44 [PATCH] fetch2/git: Only fetch extra shallow refs that exist Peter Kjellerstedt
2026-06-23  8:07 ` [bitbake-devel] " Mathieu Dubois-Briand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.